Skip to content

Running php-wasm synchronously #2203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
StyleShit opened this issue May 9, 2025 · 2 comments
Open

Running php-wasm synchronously #2203

StyleShit opened this issue May 9, 2025 · 2 comments

Comments

@StyleShit
Copy link

StyleShit commented May 9, 2025

Hey,

I'm developing a tool in TS that needs to run PHP code synchronously.
Is there a way to call php-wasm synchronously in Node environment?

I know it's not the best idea and that it might block the main thread, but the system I'm running in requires me to run the code synchronously.

Thanks! 🙏

@adamziel
Copy link
Collaborator

@StyleShit Not at the moment. PHP may make a network call or spawn a new process via popen() which, in JS, is an async operation. php.run() actually used to be synchronous before adding support for network and subprocesses. Technically, it is possible to expose a synchronous code execution handler with a limited set of features – we just don't have one today.

What's the environment you work in?

@StyleShit
Copy link
Author

I'm working on an ESLint plugin for PHP, which requires a sync parser

The parser I'm currently using has many issues, so I wanted to try nikic/PHP-Parser instead

A limited version of php wasm could be a great fit for this case!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Inbox
Development

No branches or pull requests

2 participants