PHP in WebAssembly, npm not required.
- Adding PHP-CGI support!
- Runtime extension loading!
- libicu, freetype, zlib, gd, libpng, libjpeg, openssl, & phar support.
- php-wasm, php-cgi-wasm, & php-wasm-builder are now separate packages.
- Vrzno now facilitates url fopen via the fetch() api.
- pdo_cfd1 is now a separate extension from Vrzno.
- pdo_pglite adds local Postgres support.
- SQLite is now using version 3.46.
- Demos for CodeIgniter, CakePHP, Laravel & Laminas.
- Drupal & all other demos now use standard build zip install.
- Modules are now webpack-compatible out of the box.
- Exposing FS methods w/queueing & locking to sync files between tabs & workers.
- Fixed the bug with POST requests under Firefox.
- Adding support for PHP 8.3.7 & 8.4.1.
- Automatic CI testing for PHP 8.0, 8.1, 8.2, 8.3, & 8.4.
Installing php-wasm:
$ npm i php-wasm@alpha
Installing php-cgi-wasm:
$ npm i php-cgi-wasm@alpha
Installing php-wasm-builder:
$ npm i php-wasm-builder@alpha
Drupal Demo | CakePHP Demo | CodeIgniter Demo | Laravel Demo | Laminas Demo | Code Editor |
Version 0.0.9 adds php-cgi-wasm
to the mix. This allows you to run php in web-server mode, similar to how it runs under apache or nginx. Running within a Service Worker, it can intercept and respond to HTTP requests just like a normal webserver. This means the browser can simply navigate to a URL, and PHP will generate the page, and everything will work as-normal, AJAX and all. From the perspective of the webpage, its just making HTTP requests. Its not worried about whether the PHP runs on the server or in a Service Worker.
$ npm install php-cgi-wasm
import { PhpCgiWorker } from "php-cgi-wasm/PhpCgiWorker";
// Spawn the PHP-CGI binary
const php = new PhpCgiWorker({
prefix: '/php-wasm',
docroot: '/persist/www',
types: {
jpg: 'image/jpeg',
jpeg: 'image/jpeg',
gif: 'image/gif',
png: 'image/png',
svg: 'image/svg xml',
}
});
// Set up the event handlers
self.addEventListener('install', event => php.handleInstallEvent(event));
self.addEventListener('activate', event => php.handleActivateEvent(event));
self.addEventListener('fetch', event => php.handleFetchEvent(event));
self.addEventListener('message', event => php.handleMessageEvent(event));
You can see examples of php-cgi-wasm running in a service worker and nodejs in demo-web/src/cgi-worker.mjs
& demo-node/index.mjs
respectively.
Note: php-cgi-wasm
& php-wasm
are separate packages. One "embeds" php right into your javascript, the other runs in "cgi-mode," just like php would under apache or nginx.
You can find documentation specific to php-cgi-wasm here.
Install php-wasm with npm:
$ npm install php-wasm
Include the module in your preferred format:
const { PhpWeb } = require('php-wasm/PhpWeb.js');
const php = new PhpWeb;
import { PhpWeb } from 'php-wasm/PhpWeb.mjs';
const php = new PhpWeb;
Note: This does not require npm.
const { PhpWeb } = await import('https://cdn.jsdelivr.net/npm/php-wasm/PhpWeb.mjs');
const php = new PhpWeb;
const { PhpWeb } = await import('https://www.unpkg.com/php-wasm/php-wasm/PhpWeb.mjs');
const php = new PhpWeb;
If you're using a bundler, use the vendor's documentation to learn how to move the files matching the following pattern to your public directory:
node_modules/php-wasm/php-web.mjs.wasm
node_modules/php-wasm/php-worker.mjs.wasm # ONLY if you're running the standard build in a worker
For php-cgi-wasm:
node_modules/php-cgi-wasm/php-cgi-worker.mjs.wasm
node_modules/php-cgi-wasm/php-cgi-web.mjs.wasm # ONLY if you're running the cgi build in a page
Include the php-tags.js
script from a CDN:
<script async type = "text/javascript" src = "https://cdn.jsdelivr.net/npm/php-wasm/php-tags.jsdelivr.mjs"></script>
And run some PHP right in the page!
<script type = "text/php" data-stdout = "#output">
<?php phpinfo();
</script>
<div id = "output"></div>
Inline php can use standard input, output and error with data-
attributes. Just set the value of the attribute to a selector that will match that tag.
<script async type = "text/javascript" src = "https://cdn.jsdelivr.net/npm/php-wasm/php-tags.jsdelivr.mjs"></script>
<script id = "input" type = "text/plain">Hello, world!</script>
<script type = "text/php" data-stdin = "#input" data-stdout = "#output" data-stderr = "#error">
<?php echo file_get_contents('php://stdin');
</script>
<div id = "output"></div>
<div id = "error"></div>
The src
attribute can be used on <script type = "text/php">
tags, as well as their input elements. For example:
<html>
<head>
<script async type = "text/javascript" src = "https://cdn.jsdelivr.net/npm/php-wasm/php-tags.jsdelivr.mjs"></script>
<script id = "input" src = "/test-input.json" type = "text/json"></script>
<script type = "text/php" src = "/test.php" data-stdin = "#input" data-stdout = "#output" data-stderr = "#error"></script>
</head>
<body>
<div id = "output"></div>
<div id = "error"></div>
</body>
</html>
<script async type = "text/javascript" src = "https://cdn.jsdelivr.net/npm/php-wasm/php-tags.jsdelivr.mjs"></script>
<script async type = "text/javascript" src = "https://www.unpkg.com/php-wasm/php-tags.unpkg.mjs"></script>
Create a PHP instance:
const { PhpWeb } = await import('https://cdn.jsdelivr.net/npm/php-wasm/PhpWeb.mjs');
const php = new PhpWeb;
Add your output listeners:
// Listen to STDOUT
php.addEventListener('output', (event) => {
console.log(event.detail);
});
// Listen to STDERR
php.addEventListener('error', (event) => {
console.log(event.detail);
});
Provide some input data on STDIN if you need to:
php.inputString('This is a string of data provided on STDIN.');
... then run some PHP!
const exitCode = await php.run('<?php echo "Hello, world!";');
Dynamic extensions can be loaded in static webpages like so:
<script async type = "module" src = "https://cdn.jsdelivr.net/npm/[email protected]/php-tags.mjs"></script>
<script type = "text/php" data-stdout = "#output" data-stderr = "#error" data-libs = '[
{"url": "https://unpkg.com/php-wasm-yaml/php8.3-yaml.so", "ini": true},
{"url": "https://unpkg.com/php-wasm-yaml/libyaml.so", "ini": false}
]'><?php
print yaml_emit([1,2,3,"string",["k1" => "value", "k2" => "value2", "k3" => "value3"],"now" => date("Y-m-d h:i:s")]);
</script>
You can pass in the ini
property to the constructor to add lines to /php.ini
:
const php = new PhpWeb({ini: `
date.timezone=${Intl.DateTimeFormat().resolvedOptions().timeZone}
tidy.clean_output=1
expose_php=0
`});
The /config/php.ini
and /preload/php.ini
files will also be loaded, if they exist. Neither of these files will be created if they do not exist. They're left completely up to the programmer to create & populate.
Options like the following may appear in these files. See the PHP docs for the full list.
[php]
date.timezone=UTC
tidy.clean_output=1
expose_php=0
When running in CGI mode, php will look for a php.ini
file in the document root directory, and load it along with the files listed above.
PHP will replace strings in INI files in the form ${ENVIRONMENT_VARIABLE}
with the env value of ENVIRONMENT_VARIABLE
. The PHP_VERSION
environment variable is available to allow loading of the extension compatible with the currently running version of PHP:
[php]
extension=php${PHP_VERSION}-phar.so
Remember to correctly escape the $
if you're supplying the INI from Javascript with `backtics
`:
const php = new PhpWeb({ini: `
extension=php\${PHP_VERSION}-phar.so
date.timezone=${Intl.DateTimeFormat().resolvedOptions().timeZone}
`});
The following extensions may be loaded at runtime. This allows the shared extension & their dependencies to be cached, re-used, and selected a-la-carte for each application.
- gd (https://www.npmjs.com/package/php-wasm-gd)
- iconv (https://www.npmjs.com/package/php-wasm-iconv)
- intl (https://www.npmjs.com/package/php-wasm-intl)
- xml (https://www.npmjs.com/package/php-wasm-libxml)
- dom (https://www.npmjs.com/package/php-wasm-libxml)
- simplexml (https://www.npmjs.com/package/php-wasm-libxml)
- yaml (https://www.npmjs.com/package/php-wasm-libyaml)
- zip (https://www.npmjs.com/package/php-wasm-libzip)
- mbstring (https://www.npmjs.com/package/php-wasm-mbstring)
- openssl (https://www.npmjs.com/package/php-wasm-openssl)
- phar (https://www.npmjs.com/package/php-wasm-phar)
- sqlite (https://www.npmjs.com/package/php-wasm-sqlite)
- pdo-sqlite (https://www.npmjs.com/package/php-wasm-sqlite)
- zlib (https://www.npmjs.com/package/php-wasm-zlib)
There are two ways to load extensions at runtime, using the dl()
function or php.ini
.
<?php
dl('php-8.3-xml.so');
dl('php-8.3-dom.so');
or, pass an array as the extensions
argument to the constructor from Javascript to auto-generate an ini file that loads your extensions:
const php = new PhpWeb({sharedLibs: [
`php8.3-xml.so`,
`php8.3-dom.so`,
]});
The class used to load PHP (PhpWeb
here) also implements a phpVersion property to ensure libs can be loaded for any compatible version:
const php = new PhpWeb({sharedLibs: [
`php${PhpWeb.phpVersion}-xml.so`,
`php${PhpWeb.phpVersion}-dom.so`,
]});
You can also load extensions from remote servers with URLs:
const php = new PhpWeb({sharedLibs: [`https://unpkg.com/php-wasm-phar/php8.3-phar.so`]});
The above is actually shorthand for the following code. Passing ini: true
will automatically load the extension via /php.ini
, passing ini: false
will wait for a call to dl()
to do the lookup.
const php = new PhpWeb({sharedLibs: [
{
name: `php8.3-phar.so`,
url: `https://unpkg.com/php-wasm-phar/php8.3-phar.so`,
ini: true,
}
]});
Strings starting with /
, ./
, http://
or https://
will be treated as URLs:
const php = new PhpWeb({sharedLibs: [
`./php8.3-phar.so`
]});
Some extensions require supporting libraries. You can provide URLs for those as sharedLibs
as well, just pass ini: false
:
(name
is implied to be the last section of the URL here.)
const php = new PhpWeb({sharedLibs: [
{ url: 'https://unpkg.com/php-wasm-sqlite/php8.3-sqlite.so', ini: true },
{ url: 'https://unpkg.com/php-wasm-sqlite/sqlite.so', ini: false },
]});
Dynamic extensions can be loaded as modules: So long as the main file of the module defines the getLibs
and getFiles
methods, extensions may be loaded like so:
new PhpNode({sharedLibs:[ await import('php-wasm-intl') ]})
Dynamic extensions can also be loaded as modules from any static HTTP server with an ESM directory structure.
// This will load both sqlite.so & php8.x-sqlite.so:
const php = new PhpWeb({sharedLibs: [ await import('https://cdn.jsdelivr.net/npm/php-wasm-sqlite') ]});
Sadly, this notation is not available for Service Workers, since they do not yet support dynamic imports()
. Hopefully this will change soon.
Extensions may be compiled as dynamic
, shared
, or static
. See Custom Builds
for more information on compiling php-wasm.
- dynamic - these extensions may be loaded selectively at runtime.
- shared - these extensions will always be loaded at startup and can be cached and reused.
- static - these extensions will be built directly into the main wasm binary (may cause a huge filesize).
When spawning a new instance of PHP, a files
array can be provided to be loaded into the filesystem. For example, the php-intl
extension requires us to load icudt72l.dat
into the /preload
directory.
const sharedLibs = [`https://unpkg.com/php-wasm-intl/php\${PHP_VERSION}-intl.so`];
const files = [
{
name: 'icudt72l.dat',
parent: '/preload/',
url: 'https://unpkg.com/php-wasm-intl/icudt72l.dat'
}
];
const php = new PhpWeb({sharedLibs, files});
Use the PRELOAD_ASSETS
key in your .php-wasm-rc
file to define a list of files and directories to include by default.
The files and directories will be collected into a single directory. Individual files & directories will appear in the top level, while directories will maintain their internal structure.
These files & directories will be available under /preload
in the final package, packaged into the .data
file that is built along with the .wasm
file.
PRELOAD_ASSETS='/path/to/file.txt /some/directory /path/to/other_file.txt /some/other/directory'
You can provide the locateFile
option to php-wasm as a callback to map the names of files to URLs where they're loaded from. undefined
can be returned as a fallback to default.
You can use this if your static assets are served from a different directory than your javascript.
This applies to .wasm
files, shared libraries, single files and preloaded FS packages in .data
files.
const php = new PhpWeb({locateFile: filename => `/my/static/path/${filename}`});
To use IDBFS in PhpWeb, pass a persist
object with a mountPath
key.
mountPath
will be used as the path to the persistent directory within the PHP environment.
const { PhpWeb } = await import('https://cdn.jsdelivr.net/npm/php-wasm/PhpWeb.mjs');
const php = new PhpWeb({persist: {mountPath: '/persist'}});
To use NodeFS in PhpWeb, pass a persist
object with mountPath
& localPath
keys.
localPath
will be used as the path to the HOST directory to expose to PHP.
mountPath
will be used as the path to the persistent directory within the PHP environment.
const { PhpNode } = await import('https://cdn.jsdelivr.net/npm/php-wasm/PhpNode.mjs');
const php = new PhpNode({persist: {mountPath: '/persist', localPath: '~/your-files'}});
The following EmscriptenFS methods are exposed via the php object:
Note: If you're using php-web in conjunction with php-cgi-worker to work on the filesystem, you'll need to refresh
the filesystem in the worker. You can do that with the following call using msg-bus
(see below).
// Tell the worker that the FS has been updated
await sendMessage('refresh');
Get information about a file or directory.
await php.analyzePath(path);
Get a list of files and folders in or directory.
await php.readdir(path);
Get the content of a file as a Uint8Array
by default, or optionally as utf-8.
await php.readFile(path);
await php.readFile(path, {encoding: 'utf8'});
Get information about a file or directory.
await php.stat(path);
Create a directory.
await php.mkdir(path);
Delete a directory (must be empty).
await php.rmdir(path);
Delete a file.
await php.rmdir(path);
Rename a file or directory.
await php.rename(path, newPath);
Create a new file. Content should be supplied as a Uint8Array
, or optionally as a string of text.
await php.writeFile(path, data);
await php.writeFile(path, data, {encoding: 'utf8'});
Web and Worker only!
The web and worker build use navigator.locks.request
to request a lock named php-wasm-fs-lock
before performing filesystem operations. This ensure multiple tabs & the service worker can interact with the filesystem without overwriting eachother's work. Before any FS operation takes place, the entire FS is loaded from IDBFS, and before the lock is released, the entire FS is laoded BACK into IDBFS.
The operations are enqueued asyncronously, so if multiple requests are generated before one transaction closes, they will be batched automatically. This also applies to multiple requests generated before the lock is acquired. There is generally no need to take explicit control of FS mirroring.
To suppress this behavior and take explicit control of the FS mirroring, you can pass the {autoTransaction: false}
option to the constructor. Doing this will require you to call php.startTransaction()
before any FS operations take place, and thenphp.commitTransaction()
when you're done. Using this incorrectly may leave your filesystem in a corrupted state.
await php.startTransaction();
await php.commitTransaction();
There is a msg-bus
module supplied by php-cgi-wasm
as a helper to communicate with php running inside a worker. The module exposes two functions: sendMessageFor
and onMessage
.
This allows you to simply await
the result of calls to file system methods (see above) on the service worker:
const result = await sendMessage(methodName, [param, param, param]);
- Use
onMessage
as an event handler formessage
events coming from the Service Worker. - Use
sendMessageFor
to GENERATE A FUNCTION that you can use to send messages to your service worker.
import { onMessage, sendMessageFor } from `php-cgi-wasm/msg-bus`;
const SERVICE_WORKER_SCRIPT_URL = '/cgi-worker.mjs';
navigator.serviceWorker.register(SERVICE_WORKER_SCRIPT_URL);
navigator.serviceWorker.addEventListener('message', onMessage);
const sendMessage = sendMessageFor(SERVICE_WORKER_SCRIPT_URL);
const result = await sendMessage(methodName, [param, param, param]);
Once you've got the above set up, use php.handleMessageEvent
to handle the message
events on the service worker:
self.addEventListener('message', event => php.handleMessageEvent(event));
To use the the in-place builder, first install php-wasm-builder
globally:
Requires docker, docker-compose, coreutils, wget, & make.
$ npm install -g php-wasm-builder
Create the build environment (can be run from anywhere):
$ php-wasm-builder image
Optionally clean up files from a previous build:
$ php-wasm-builder clean
Then navigate to the directory you want the files to be built in, and run php-wasm-builder build
$ cd ~/my-project
$ php-wasm-builder build
# php-wasm-builder build web
# "web" is the default here
$ cd ~/my-project
$ php-wasm-builder build node
Build ESM modules with:
$ php-wasm-builder build web mjs
$ php-wasm-builder build node mjs
Build CGI modules with:
$ php-wasm-builder build web cgi mjs
$ php-wasm-builder build worker cgi mjs
This will build the package inside of the current directory (or in PHP_DIST_DIR
, see below for more info.)
You can also create a .php-wasm-rc
file in this directory to customize the build.
# Select a PHP version
PHP_VERSION=8.3
# Build the package to a directory other than the current one (RELATIVE path)
PHP_DIST_DIR=./public
# Build the extensions to a directory other than the current one (RELATIVE path)
PHP_ASSET_DIR=./public
# Build the cgi package to a directory other than the current one (RELATIVE path)
PHP_CGI_DIST_DIR=./public
# Build the cgi package's extensions to a directory other than the current one (RELATIVE path)
PHP_CGI_ASSET_DIR=./public
# Space separated list of files/directories (ABSOLUTE paths)
# to be included under the /preload directory in the final build.
PRELOAD_ASSETS=~/my-project/php-scripts ~/other-dir/example.php
# Memory to start the instance with, before growth
INITIAL_MEMORY=2048MB
# Build with assertions enabled
ASSERTIONS=0
# Select the optimization level
OPTIMIZATION=3
# Build with extensions
WITH_GD=1
WITH_LIBPNG=1
WITH_LIBJPEG=1
WITH_FREETYPE=1
The following options may appear in .php-wasm-rc
.
8.0|8.1|8.2|8.3
This is the directory where javascript & wasm files will be built to, relative to the current directory.
This is the directory where shared libs, extension, .data
files & other supporting files will be built to, relative to the current directory. Defaults to PHP_DIST_DIR
.
0|1|2|3
The optimization level to use while compiling.
The optimization level to use while compiling libraries. Defaults to OPTIMIZE
.
A list of absolute paths to files & directories to build to the /preload
directory. Will produce a .data
file.
0|1
Build with/without assertions.
As stated above, extensions may be compiled as dynamic
, shared
, or static
.
- dynamic - these extensions may be loaded selectively at runtime.
- shared - these extensions will always be loaded at startup and can be cached and reused.
- static - these extensions will be built directly into the main wasm binary (may cause a huge filesize).
(defaults provided below in bold)
The following options are availavle for building static PHP extensions:
WITH_BCMATH # [0, 1] Enabled by default
WITH_CALENDAR # [0, 1] Enabled by default
WITH_CTYPE # [0, 1] Enabled by default
WITH_EXIF # [0, 1] Enabled by default
WITH_FILTER # [0, 1] Enabled by default
WITH_TOKENIZER # [0, 1] Enabled by default
WITH_VRZNO # [0, 1] Enabled by default
The following extension may be compiled as static, shared or dynamic:
WITH_PHAR # [0, 1, static, dynamic]
WITH_LIBXML # [0, 1, static, shared]
WITH_ICONV # [0, 1, static, shared, dynamic]
WITH_SQLITE # [0, 1, static, shared, dynamic]
WITH_LIBZIP # [0, 1, static, shared, dynamic]
WITH_ZLIB # [0, 1, static, shared, dynamic]
WITH_GD # [0, 1, static, shared, dynamic]
WITH_LIBPNG # [0, 1, static, shared]
WITH_FREETYPE # [0, 1, static, shared]
WITH_LIBJPEG # [0, 1, static, shared]
WITH_YAML # [0, 1, static, shared, dynamic]
WITH_TIDY # [0, 1, static, shared, dynamic]
WITH_MBSTRING # [0, 1, static, dynamic]
WITH_ONIGURUMA # [0, 1, static, shared]
WITH_OPENSSL # [0, 1, shared, dynamic]
WITH_INTL # [0, 1, static, shared, dynamic]
static|dynamic
When compiled as a dynamic
extension, this will produce the extension file php8.x-phar.so
.
static|shared
This actual php-libxml
extension must be statically compiled, but libxml
itself may be loaded as a shared library.
When compiled as a shared
library, it will produce the library libxml.so
.
static|shared|dynamic
When compiled as a dynamic
extension, this will produce the extension php-8.x-zip.so
.
When compiled as a dynamic
or shared
extension, it will produce the library libzip.so
.
This extension depends on zlib
.
static|shared|dynamic
When compiled as a dynamic
extension, this will produce the extension php-8.x-iconv.so
.
When compiled as a dynamic
or shared
extension, it will produce the library libiconv.so
.
static|shared|dynamic
When compiled as a dynamic
extension, this will produce the extensions php-8.x-sqlite.so
, & php-8.x-pdo-sqlite.so
.
When compiled as a dynamic
or shared
extension, it will produce the library libsqlite3.so
.
static|dynamic
This extenstion makes use of freetype
, libjpeg
, libpng
, & zlib
.
When compiled as a dynamic
extension, this will produce the extension php-8.x-gd.so
.
static|shared
When compiled as a shared
library, this will produce the library libpng.so
.
If WITH_GD is dynamic, then loading will be deferred until after gd is loaded.
static|shared
When compiled as a shared
library, this will produce the library libfreetype.so
.
If WITH_GD is dynamic, then loading will be deferred until after gd is loaded.
static|shared
When compiled as a shared
library, this will produce the library libjpeg.so
.
If WITH_GD is dynamic, then loading will be deferred until after gd is loaded.
static|shared|dynamic
When compiled as a dynamic
extension, this will produce the extension php-8.x-zlib.so
.
When compiled as a dynamic
or shared
extension, it will produce the library libz.so
.
static|shared|dynamic
When compiled as a dynamic
extension, this will produce the extension php-8.x-yaml.so
.
When compiled as a dynamic
or shared
extension, it will produce the library libyaml.so
.
static|shared|dynamic
When compiled as a dynamic
extension, this will produce the extension php-8.x-tidy.so
.
When compiled as a dynamic
or shared
extension, it will produce the library libtidy.so
.
static|dynamic
When compiled as a dynamic
extension, this will produce the extension php-8.x-mbstring.so
.
static|shared|dynamic
Support library for mbstring
.
When compiled as a dynamic
or shared
library, this will produce the library libonig.so
.
If WITH_MBSTRING
is dynamic
, then loading will be deferred until after mbstring
is loaded.
shared|dynamic
When compiled as a dynamic
extension, this will produce the extension php-8.x-openssl
.
When compiled as a dynamic
or shared
extension, it will produce the libraries libssl.so
& libcrypto.so
.
static|shared|dynamic
When compiled as a dynamic
, or shared
extension, this will produce the extension php-8.x-intl.so
& the following libraries:
- libicuuc.so
- libicutu.so
- libicutest.so
- libicuio.so
- libicui18n.so
- libicudata.so
- icudt72l.dat
Use this to build custom version of php-wasm. Its recommended to build this to an empty directory using a .php-wasm-rc
file.
npx php-wasm-builder build
This will build the docker container used to build php-wasm.
npx php-wasm-builder image
This will scan the current package's node_modules directory for shared libraries & supporting files, and copy them to PHP_ASSET_DIR
.
You can use this with .php-wasm-rc
to copy assets even if you're not using a custom build.
npx php-wasm-builder copy-assets
Similar to copy-assets
, but will actually compile the shared libaries, then copy them to PHP_ASSET_DIR
.
You can use this with .php-wasm-rc
to copy assets even if you're not using a custom build.
npx php-wasm-builder build-assets
Clear cached build resources.
npx php-wasm-builder clean
Clear out all downloaded dependencies and start from scratch.
npx php-wasm-builder deep-clean
Print the help text for a given command
npx php-wasm-builder help COMMAND
The repository pib-legacy was created to preserve the original state of the project.
The repository pib-legacy
was created to preserve the original state of the project: https://github.com/seanmorris/pib-legacy
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
http://www.apache.org/licenses/LICENSE-2.0
Special thanks to Alex Haussmann