Running PHP and QCObjects
Sometimes you just don’t want or can’t migrate your old PHP code to JavaScript and as a result you can’t introduce your new clean and powerful Node environment to your company. Also you were experiencing some issues with the express library in terms of stability and scalability of your API because sometimes it isn’t the classic ready to go stuff what fits better with your implementation.
Let me tell you there is a solution for every problem and here is mine:
Yes, it is possible to run PHP into QCObjects and make a PWA into a Node environment with a stable API that is capable to catch relative and absolute paths.
This is still in experimental stage but I sure you can take advantage of the power of PHP running into a Node.js environment without using express but a powerful Microservices API using QCObjects.
Step 1:
First create a new php app into an empty folder
> qcobjects create —php mynewapp
Step 2:
Run the built-in HTTP2 server
> qcobjects launch mynewapp
Step 3:
In the browser, go to the following address:
Done.
In your generated code, you can edit any component inside the templates/components folder and write php code like this <?php phpinfo(); ?> and test it.
Check out the config.json file that was generated by the CLI Tool to view the route paths settings needed to point to the php files.
Check out the org.quickcorp.backend.php.custom.js file into the js/packages folder to see how to code a custom micro-service to handle PHP files and content.
Now you can interact with PHP into your QCObjects and Node environment
Enjoy!