Useful skeleton for RESTful API development, using Slim PHP micro-framework.
The main technologies used in this project are:
You can create a new project running the following commands:
composer create-project maurobonfietti/slim4-api-skeleton [my-api-name]
cd [my-api-name]
composer test
composer start
By default, the API uses a MySQL database.
You should check and edit this configuration in your .env
file:
DB_HOST='127.0.0.1'
DB_NAME='yourMySqlDatabase'
DB_USER='yourMySqlUsername'
DB_PASS='yourMySqlPassword'
DB_PORT='3306'
If you like Docker, you can use this project with Docker and Docker Compose.
Minimal Docker Version:
Docker Commands:
# Create and start containers for the API.
docker-compose up -d --build
# Checkout the API.
curl http://localhost:8081
# Stop and remove containers.
docker-compose down
.env
to getenv()
, $_ENV
and $_SERVER
automagically.Hello: GET /
Health Check: GET /status
Learn how to develop a RESTful API with PHP and Slim 4 by following this video [🎥 🔈 🇪🇸 🇦🇷]
If you would like to support this project, you can:
Now, go to build an excellent RESTful API.