Repository Badge PHP Example

March 13, 2023 ยท View on GitHub

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: PHP Example: OK

Requirements

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.

In this 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.

Setup

Once your environment is set up, you can run:

npm install

serverless deploy

Running

Then, from the given URL, you can run open your browser and navigate to it. You should see the default example: Scaleway: approved

You can tweak the following query parameters to make this badge your own:

keydescription
textThe text you want the badge to show. Default: Scaleway
statusThe status text you want the badge to show. Default: approved
colorThe color of the status part. Default: green. This exemple does not accept hex color code, please use their literal names