maurobonfietti / slim4-api-skeleton
Useful skeleton for RESTful API development, using PHP and Slim 4.
Package info
github.com/maurobonfietti/slim4-api-skeleton
pkg:composer/maurobonfietti/slim4-api-skeleton
Fund package maintenance!
Requires
- php: ^8.3
- ext-json: *
- ext-pdo: *
- pimple/pimple: ^3.2
- slim/psr7: ^1.4.0
- slim/slim: ^4.5
- vlucas/phpdotenv: ^5.1
Requires (Dev)
- maurobonfietti/skel-api-slim-php-crud-generator: dev-master
- nunomaduro/phpinsights: ^2.0
- phpunit/phpunit: ^9.0
- symfony/console: ^4.4
This package is auto-updated.
Last update: 2026-05-29 01:37:20 UTC
README
Useful skeleton for RESTful API development, using Slim PHP micro-framework.
💻 TECHNOLOGIES USED:
The main technologies used in this project are:
- PHP 8
- Slim 4
- MySQL
- PHPUnit
- dotenv
- Docker
- Docker Compose
⚙️ QUICK INSTALL:
Requirements:
- Composer.
- PHP >= 8.1
- MySQL/MariaDB.
- or Docker.
With Composer:
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
Configure your connection to MySQL Server:
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'
With Docker:
If you like Docker, you can use this project with Docker and Docker Compose.
Minimal Docker Version:
- Engine: 18.03+
- Compose: 1.21+
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
📦 DEPENDENCIES:
LIST OF REQUIRE DEPENDENCIES:
- slim/slim: Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.
- slim/psr7: PSR-7 implementation for use with Slim 4.
- pimple/pimple: A small PHP dependency injection container.
- vlucas/phpdotenv: Loads environment variables from
.envtogetenv(),$_ENVand$_SERVERautomagically.
LIST OF DEVELOPMENT DEPENDENCIES:
- phpunit/phpunit: The PHP Unit Testing framework.
- symfony/console: The Console component eases the creation of beautiful and testable command line interfaces.
- nunomaduro/phpinsights: Instant PHP quality checks from your console.
- maurobonfietti/slim4-api-skeleton-crud-generator: CRUD Generator for Slim 4 - Api Skeleton.
🔖 ENDPOINTS:
BY DEFAULT:
-
Hello:
GET / -
Health Check:
GET /status
📹 TUTORIAL:
Learn how to develop a RESTful API with PHP and Slim 4 by following this video [🎥 🔈 🇪🇸 🇦🇷]
Desarrollar.una.API.RESTful.con.PHP.y.Slim.4.mp4
❤️ SUPPORT THE PROJECT
If you would like to support this project, you can:
- Invite the author a coffee ☕ 😋
- Give a star to the repository ⭐ 😊
😎 AND THAT'S IT!
Now, go to build an excellent RESTful API.