Saturday 15 January 2011

curl - Run composer with a PHP script in browser -


It is possible to execute composer with a little PHP encoding from the browser because I don

Surely you can do this with curls?

Yes, you can run composer with a little PHP wrapper. All the composer source codes are available for the file, so it can be removed and then you can run after setting an encoding interface to replace the composer, rather than the commands that come through the command line.

If you setup your directory structure like this:

  ./project/project/composer.json ./project/composer.lock ./project/webroot/ ComposerExtractor.php ./project/ var /   

Place the code in Composer Extractor.php and then run it from a web browser, the composer should download all these libraries to: / P>

 . / Project / vendors /   

Also generate class-loader files in that directory.

Composer Extractor.

  & lt ;? Php define ('EXTRACT_DIRECTORY', "../var/extractedComposer"); If (file_exists (EXTRACT_DIRECTORY '/ vendor / autoload.php') == true). {Echo "ejected autoload is already present as it is already extracted. Phar extraction is being omitted". } And {$ musician PHhar = new Phar ("Composer.phar"); //php.ini Settings phar.readonly to 0 $ composer Fhar- & gt; Should be set to extractTo (EXTRACT_DIRECTORY); } // This form has been successfully removed. Need_once (EXTRACT_DIRECTORY. '/ Vendor / autoload.php'); // composer classes use composer \ console \ application; Use composer \ command \ update comand; Use Symfony \ Component \ Console \ Input \ ArrayInput; // To get out of Webroot so that the files of vendors can not be made in // which will be visible to the inthegaon chdir ('../'); // command $ input = create new ArrayInput (array ('command' = & gt; 'update')); // Create an application and run it with $ application = new application (); $ Application & gt; Run ($ input); ? & Gt;   

Although this is possible, this is not a great idea, but if you can not use a host that gives you SSH access, then it may be necessary.

I firmly recommend getting a steady IP address for myself or your office and then only restrict access to your own IP, as well as possibly to this script. After deleting it on the server to prevent it from accidentally running again.

No comments:

Post a Comment