Skip to content
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

Feature Request: Add an option for preprocessing PHP code before parsing #1004

Open
ywisax opened this issue May 21, 2024 · 0 comments
Open

Comments

@ywisax
Copy link

ywisax commented May 21, 2024

Is it possible for kphp / kphp2cpp to provide an option that allows for a preprocessing step before PHP code is parsed? Currently, most Composer packages cannot be used directly with KPHP. If there was an option that lets developers define a custom script to preprocess the code, making it possible to fix incompatibilities on their own, this would greatly enhance compatibility.

I envision the API could look something like this:
/Users/abc/kphp/objs/bin/kphp2cpp --composer-root /Users/abc/projectA -M cli /Users/abc/projectA/002.php --pre-handler=/Users/abc/projectA/pre-handler.php.

The pre-handler parameter doesn't necessarily have to be defined as a PHP script; it could also be a shell script. It would take a filename as input and output the processed PHP code.

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

No branches or pull requests

1 participant