This example demonstrates how PHP functions work using a dependency from composer. With this example, you can generate a simple badge with the text, status and color of your choice, just like this one:
This example assumes you are familiar with how serverless functions work. If needed, you can check Scaleway official documentation
This example uses the Scaleway Serverless Framework Plugin. Please set up your environment with the requirements stated in the Scaleway Serverless Framework Plugin before trying out the example.
This example shows to create a basic PHP function with dependencies provided in a composer.json file. The function generates an SVG image using Twig based on user input.
Once your environment is set up, you can run:
npm install
serverless deploy
Then, from the given URL, you can run open your browser and navigate to it. You should see the default example:
You can tweak the following query parameters to make this badge your own:
key | description |
---|---|
text | The text you want the badge to show. Default: Scaleway |
status | The status text you want the badge to show. Default: approved |
color | The color of the status part. Default: green. This exemple does not accept hex color code, please use their literal names |