This is a simple project written in Silex, running on Docker. It features two classic getting started examples - Hello, World! and Fizzbuzz. See the endpoint examples for more details.
You will need Docker Compose which is included with Docker on Mac and Windows systems. Other systems please refer to the Docker Compose install docs.
Run the following command to start the server:
docker-compose up -d --build
Note the -d
flag which backgrounds the PHP dev server.
To stop the server run:
docker-compose down
### Logs
To tail the logs while the server is running use the following command:
docker logs -f docker-silex
Request:
GET /hello/$name
Params:
$name
- The value which will be interpolated to the string "Hello $name
!"
Example:
GET /hello/world
Returns:
{
message: "Hello world!"
}
Request:
GET /hello/$number
Params:
$number
- Must be an integer between 1 and 100. Non integers or values outside this range will return a 400 error.
Example:
GET /fizzbuzz/15
Returns:
{
number: "15",
fizz: true,
buzz: true
}