@php-wasm/node 3.1.20 → 3.1.22

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 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
- - SQLite
6
- - Libzip
7
- - Libpng
8
- - CLI
9
- - OpenSSL
10
- - MySQL
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,45 @@ 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 `.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
+ The older `withIntl`, `withXdebug`, `withRedis`, and `withMemcached` loader
67
+ options still work, but new code should use `extensions`.
68
+
30
69
  ## Attribution
31
70
 
32
71
  `@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.