@php-wasm/node 3.1.21 → 3.1.25
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 +49 -6
- package/index.cjs +322 -348
- package/index.js +313 -343
- package/lib/extensions/load-extensions.d.ts +61 -0
- package/lib/extensions/node-extension-resources.d.ts +20 -0
- package/lib/index.d.ts +1 -1
- package/lib/load-runtime.d.ts +21 -1
- package/package.json +19 -19
- package/lib/extensions/intl/with-intl.d.ts +0 -2
- package/lib/extensions/memcached/with-memcached.d.ts +0 -2
- package/lib/extensions/redis/with-redis.d.ts +0 -2
- package/lib/extensions/xdebug/with-xdebug.d.ts +0 -11
package/README.md
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
This package ships WebAssembly PHP binaries and the JavaScript API optimized for Node.js. It comes with the following PHP extensions:
|
|
4
4
|
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
5
|
+
- SQLite
|
|
6
|
+
- Libzip
|
|
7
|
+
- Libpng
|
|
8
|
+
- CLI
|
|
9
|
+
- OpenSSL
|
|
10
|
+
- MySQL
|
|
11
11
|
|
|
12
12
|
It uses the host filesystem directly and can access the network if you plug in a custom
|
|
13
13
|
WS proxy.
|
|
@@ -27,6 +27,49 @@ const output = await php.runStream({
|
|
|
27
27
|
console.log(await output.stdoutText);
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
## Loading PHP extensions
|
|
31
|
+
|
|
32
|
+
Pass `extensions` to `loadNodeRuntime()` to load optional PHP extensions before
|
|
33
|
+
PHP starts:
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
const php = new PHP(
|
|
37
|
+
await loadNodeRuntime('8.4', {
|
|
38
|
+
extensions: ['intl', 'redis', 'memcached', { name: 'xdebug', options: { ideKey: 'PLAYGROUND' } }],
|
|
39
|
+
})
|
|
40
|
+
);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`@php-wasm/node` ships `intl`, `xdebug`, `redis`, and `memcached`. It can also
|
|
44
|
+
load external JSPI `.so` artifacts from a manifest:
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
const php = new PHP(
|
|
48
|
+
await loadNodeRuntime('8.4', {
|
|
49
|
+
extensions: [
|
|
50
|
+
{
|
|
51
|
+
source: {
|
|
52
|
+
format: 'manifest',
|
|
53
|
+
manifestUrl: './dist/wp_mysql_parser/manifest.json',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
})
|
|
58
|
+
);
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
In Node.js, `manifestUrl` may be a local path, a `file:` URL, or an HTTP(S)
|
|
62
|
+
URL. Relative local paths are resolved from the current working directory.
|
|
63
|
+
Relative artifact files in the manifest are resolved against the manifest
|
|
64
|
+
location.
|
|
65
|
+
|
|
66
|
+
External extensions are only supported when the Node.js runtime has JSPI
|
|
67
|
+
available. Asyncify support is limited to the bundled extensions shipped with
|
|
68
|
+
this package.
|
|
69
|
+
|
|
70
|
+
The older `withIntl`, `withXdebug`, `withRedis`, and `withMemcached` loader
|
|
71
|
+
options still work, but new code should use `extensions`.
|
|
72
|
+
|
|
30
73
|
## Attribution
|
|
31
74
|
|
|
32
75
|
`@php-wasm/node` started as a fork of the original PHP to WebAssembly build published by Oraoto in https://github.com/oraoto/pib and modified by Sean Morris in https://github.com/seanmorris/php-wasm.
|