maurobonfietti / slim4-api-skeleton
Useful skeleton for RESTful API development, using PHP and Slim 4.
Fund package maintenance!
Ko Fi
Installs: 2 141
Dependents: 0
Suggesters: 0
Security: 0
Stars: 132
Watchers: 7
Forks: 32
Open Issues: 2
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
- dev-master
- 1.1.0.x-dev
- 1.1.0
- 1.0.0.x-dev
- 1.0.0
- 0.42.0.x-dev
- 0.42.0
- 0.41.0.x-dev
- 0.41.0
- 0.40.0.x-dev
- 0.40.0
- 0.39.0.x-dev
- 0.39.0
- 0.38.0.x-dev
- 0.38.0
- 0.37.0.x-dev
- 0.37.0
- 0.36.0.x-dev
- 0.36.0
- 0.35.0.x-dev
- 0.35.0
- 0.34.0
- 0.33.0.x-dev
- 0.33.0
- 0.32.0.x-dev
- 0.32.0
- 0.31.0.x-dev
- 0.31.0
- 0.30.0.x-dev
- 0.30.0
- 0.29.0.x-dev
- 0.29.0
- 0.28.0.x-dev
- 0.28.0
- 0.27.0.x-dev
- 0.27.0
- 0.26.0.x-dev
- 0.26.0
- 0.25.0.x-dev
- 0.25.0
- 0.24.0.x-dev
- 0.24.0
- 0.23.0.x-dev
- 0.23.0
- 0.22.0.x-dev
- 0.22.0
- 0.21.0.x-dev
- 0.21.0
- 0.20.0.x-dev
- 0.20.0
- 0.19.0.x-dev
- 0.19.0
- 0.18.0.x-dev
- 0.18.0
- 0.17.0.x-dev
- 0.17.0
- 0.16.0.x-dev
- 0.16.0
- 0.15.0.x-dev
- 0.15.0
- 0.14.0.x-dev
- 0.14.0
- 0.13.0.x-dev
- 0.13.0
- 0.12.0.x-dev
- 0.12.0
- 0.11.0.x-dev
- 0.11.0
- 0.10.0.x-dev
- 0.10.0
- 0.9.0.x-dev
- 0.9.0
- 0.8.0.x-dev
- 0.8.0
- 0.7.0.x-dev
- 0.7.0
- 0.6.0.x-dev
- 0.6.0
- 0.5.0.x-dev
- 0.5.0
- 0.4.0.x-dev
- 0.4.0
- 0.3.0.x-dev
- 0.3.0
- 0.2.0.x-dev
- 0.2.0
- 0.1.1.x-dev
- 0.1.1
- 0.1.0.x-dev
- 0.1.0
- 0.0.7.x-dev
- 0.0.7
- 0.0.6.x-dev
- 0.0.6
- 0.0.5.x-dev
- 0.0.5
- 0.0.4.x-dev
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1
- dev-develop
- dev-slim
This package is auto-updated.
Last update: 2024-10-30 16:26:24 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
.env
togetenv()
,$_ENV
and$_SERVER
automagically.
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.