@php-wasm/web 0.1.60 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/php_8_2.wasm CHANGED
Binary file
package/README.md DELETED
@@ -1,31 +0,0 @@
1
- # WebAssembly PHP for the web
2
-
3
- This package ships WebAssembly PHP binaries and the JavaScript API optimized for the web and a low bundle size. It comes with the Libzip extension and the SQLite extension.
4
-
5
- Here's how to use it:
6
-
7
- ```js
8
- import { PHP } from '@php-wasm/web';
9
-
10
- // PHP.load() calls import('php.wasm') internally
11
- // Your bundler must resolve import('php.wasm') as a static file URL.
12
- // If you use Webpack, you can use the file-loader to do so.
13
- const php = await PHP.load('8.0', {
14
- requestHandler: {
15
- documentRoot: '/www',
16
- },
17
- });
18
-
19
- // Create and run a script directly
20
- php.mkdirTree('/www');
21
- php.writeFile('/www/index.php', `<?php echo "Hello " . $_POST['name']; ?>`);
22
- await php.run({ scriptPath: './index.php' });
23
-
24
- // Or use the familiar HTTP concepts:
25
- const response = await php.request({
26
- method: 'POST',
27
- url: '/index.php',
28
- data: { name: 'John' },
29
- });
30
- console.log(response.text);
31
- ```