@php-wasm/node 0.1.16 → 0.1.18
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/README.md +10 -13
- package/index.cjs +34 -30
- package/index.d.ts +257 -308
- package/package.json +5 -3
- package/packages/php-wasm/node/README.md +10 -13
- package/php_5_6.wasm +0 -0
- package/php_7_0.wasm +0 -0
- package/php_7_1.wasm +0 -0
- package/php_7_2.wasm +0 -0
- package/php_7_3.wasm +0 -0
- package/php_7_4.wasm +0 -0
- package/php_8_0.wasm +0 -0
- package/php_8_1.wasm +0 -0
- package/php_8_2.wasm +0 -0
|
@@ -15,25 +15,22 @@ WS proxy.
|
|
|
15
15
|
Here's how to use it:
|
|
16
16
|
|
|
17
17
|
```js
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
const php = new PHP(await loadPHPRuntime(await getPHPLoaderModule('8.0')));
|
|
18
|
+
import { PHP } from '@php-wasm/node';
|
|
19
|
+
const php = PHP.load('8.0', {
|
|
20
|
+
requestHandler: {
|
|
21
|
+
documentRoot: new URL('./', import.meta.url).pathname,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
25
24
|
|
|
26
25
|
// Create and run a script directly
|
|
27
26
|
php.writeFile('./index.php', `<?php echo "Hello " . $_POST['name']; ?>`);
|
|
28
|
-
php.run({ scriptPath: './index.php' });
|
|
27
|
+
await php.run({ scriptPath: './index.php' });
|
|
29
28
|
|
|
30
29
|
// Or use the familiar HTTP concepts:
|
|
31
|
-
const
|
|
32
|
-
documentRoot: new URL('./', import.meta.url).pathname,
|
|
33
|
-
});
|
|
34
|
-
const response = server.request({
|
|
30
|
+
const response = await php.request({
|
|
35
31
|
method: 'POST',
|
|
36
|
-
|
|
32
|
+
url: '/index.php',
|
|
37
33
|
data: { name: 'John' },
|
|
38
34
|
});
|
|
35
|
+
console.log(response.text);
|
|
39
36
|
```
|
package/php_5_6.wasm
CHANGED
|
Binary file
|
package/php_7_0.wasm
CHANGED
|
Binary file
|
package/php_7_1.wasm
CHANGED
|
Binary file
|
package/php_7_2.wasm
CHANGED
|
Binary file
|
package/php_7_3.wasm
CHANGED
|
Binary file
|
package/php_7_4.wasm
CHANGED
|
Binary file
|
package/php_8_0.wasm
CHANGED
|
Binary file
|
package/php_8_1.wasm
CHANGED
|
Binary file
|
package/php_8_2.wasm
CHANGED
|
Binary file
|