github.com/iron-io/functions@v0.0.0-20180820112432-d59d7d1c40b2/examples/hello/php/README.md (about) 1 ## Quick Example for a PHP Function (4 minutes) 2 3 This example will show you how to test and deploy Go (Golang) code to IronFunctions. 4 5 ### 1. Prepare the `func.yaml` file: 6 7 At func.yaml you will find: 8 9 ```yml 10 name: USERNAME/hello 11 version: 0.0.1 12 path: /hello 13 build: 14 - docker run --rm -v "$PWD":/worker -w /worker iron/php:dev composer install 15 ``` 16 17 The important step here is to ensure you replace `USERNAME` with your Docker Hub account name. Some points of note: 18 the application name is `phpapp` and the route for incoming requests is `/hello`. These informations are relevant for 19 the moment you try to test this function. 20 21 ### 2. Build: 22 23 ```sh 24 # build the function 25 fn build 26 # test it 27 cat hello.payload.json | fn run 28 # push it to Docker Hub 29 fn push 30 # Create a route to this function on IronFunctions 31 fn routes create phpapp /hello 32 ``` 33 34 `-v` is optional, but it allows you to see how this function is being built. 35 36 ### 3. Queue jobs for your function 37 38 Now you can start jobs on your function. Let's quickly queue up a job to try it out. 39 40 ```sh 41 cat hello.payload.json | fn call phpapp /hello 42 ``` 43 44 Here's a curl example to show how easy it is to do in any language: 45 46 ```sh 47 curl -H "Content-Type: application/json" -X POST -d @hello.payload.json http://localhost:8080/r/phpapp/hello 48 ```