rabbah closed pull request #3728: Add information on using Composer with the PHP runtime URL: https://github.com/apache/incubator-openwhisk/pull/3728
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/docs/actions.md b/docs/actions.md index 36edb62551..05de898a59 100644 --- a/docs/actions.md +++ b/docs/actions.md @@ -644,6 +644,19 @@ and then create the action: wsk action create helloPHP --kind php:7.1 helloPHP.zip ``` +### Including Composer dependencies + +If your PHP action requires [Composer](https://getcomposer.org) dependencies, you can install them as usual using `composer require` which will create a `vendor` directory. Add this directory to your action's zip file and create the action: + +```bash +zip -r helloPHP.zip index.php vendor +wsk action create helloPHP --kind php:7.1 helloPHP.zip +``` + +The PHP runtime will automatically include Composer's autoloader for you, so you can immediately use the dependencies in your action code. + +Note that if you don't include your own `vendor` folder, then the runtime will include one for you. The packages included are listed in the [reference](https://github.com/apache/incubator-openwhisk/blob/master/docs/reference.md#composer-packages). + ## Creating Swift actions ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
