Skip to content

Conversation

mho22
Copy link
Collaborator

@mho22 mho22 commented Aug 26, 2025

Motivation for the change, related issues

This is a pull request to dynamically load Intl in @php-wasm Node ASYNCIFY.

Related issues and pull requests

Issues

Pull requests

Implementation details

Intl Dynamic Extension Compilation ASYNCIFY

  • Improvement to the specific Intl dynamic extension Dockerfile file based on PHP versions and ASYNCIFY
  • Modification of the dedicated project.json file which will store the list of compilation commands related to each dynamic extension for asyncify.
  • Compilation of every version of Intl Dynamic Extension For Asyncify

PHP.wasm Node WithIntl option

  • Add Intl extension file import for Asyncify
  • Test the correct use of the extension in the php-dynamic-loading.spec.ts file.
  • Keep the Intl static extension compilation process for PHP.wasm Web.

Testing Instructions (or ideally a Blueprint)

test.js

import { PHP } from '@php-wasm/universal'; import { loadNodeRuntime } from '@php-wasm/node'; const script = `<?php  $formatter = numfmt_create('en-US', NumberFormatter::CURRENCY); echo numfmt_format($formatter, 100.00); $formatter = numfmt_create('fr-FR', NumberFormatter::CURRENCY); echo numfmt_format($formatter, 100.00);  ?>`; const php = new PHP( await loadNodeRuntime( '8.3', { withIntl : true } ) ); const result = await php.runStream( { code : script } ); console.log( await result.stdoutText );
> node scripts/example.js //withIntl : true $100.00100,00 € //withIntl : false <br /> <b>Fatal error</b>: Uncaught Error: Call to undefined function numfmt_create() in /internal/eval.php:3 Stack trace: #0 {main} thrown in <b>/internal/eval.php</b> on line <b>3</b><br /> 

Next steps

  • Experimental PHP Node JSPI 8.3
  • PHP.wasm Node JSPI
  • PHP.wasm Node Asyncify
  • PHP.wasm Web
  • Remove artifacts in PHP.wasm
  • Remove artifacts in Playground
  • Move Xdebug in shared directory alongside Intl
@adamziel
Copy link
Collaborator

This one might need a rebase

@mho22
Copy link
Collaborator Author

mho22 commented Aug 29, 2025

This one might need a rebase

Of course. I am on it.

@mho22 mho22 force-pushed the add-intl-dynamic-extension-support-to-php-wasm-node-asyncify branch 2 times, most recently from 504b4a9 to 0d1ed08 Compare September 1, 2025 18:26
@mho22 mho22 force-pushed the add-intl-dynamic-extension-support-to-php-wasm-node-asyncify branch from 0d1ed08 to a8d648d Compare September 1, 2025 18:30
@mho22 mho22 marked this pull request as ready for review September 1, 2025 19:52
@adamziel adamziel merged commit 65029ca into trunk Sep 2, 2025
26 checks passed
@adamziel adamziel deleted the add-intl-dynamic-extension-support-to-php-wasm-node-asyncify branch September 2, 2025 11:25
@adamziel
Copy link
Collaborator

adamziel commented Sep 2, 2025

This looks really good, thank you @mho22!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment