Skip to content

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

@ywisax

Description

@ywisax

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions