I am trying to determine the deployment procedure based on the command:
php <phar_file_deployed_on_server>.phar
This command creates an index.php file external to the phar archive.
The index.php file will act as a thin manager for the N-file.php inside the phar archive.
An example of the generated index.php file:
<? $requiredFile = "phar://<phar_file_deployed_on_server>.phar"; if (array_key_exists("getParameter", $_GET)) $requiredFile = $requiredFile . "/" . $_GET['getParameter'] . ".php"; else <handling_of_else_condition>; require_once $requiredFile;
The above dispatch rule.
My idea is focused only on the deployment procedure. In the example, the $ _GET array is specified, but a more complex rule generated during deployment is possible (for example, via the command line parameter).
I created a PHP web application and compressed it into a Phar format for easy deployment.
An application can be executed without decompression in production because I planned the index.php file, which refers to the application in the Phar archive.
To generate the index.php file during deployment, run the following command in the shell of the working machine:
php <just_deployed_phar_file>
The code inside the stub file generates the index.php file in order to reference the newly installed Phar archive.
Is this the right way to use stubs?
source share