- Laravel 12 REST API starter, ready for develop and customization.
- Dockerized environment: PHP-FPM , Nginx, MySQL, phpMyAdmin, and Mailhog.
- Easy setup with Docker Compose.
- Postman API documentation link for quick reference.
Service | Description | Ports | Healthcheck |
---|---|---|---|
app | PHP-FPM container for Laravel | - | Yes (depends on DB) |
nginx | Web server serving the application | 80:80 | - |
database | MySQL 8.0 database | 3306:3306 | Yes |
phpmyadmin | Database management UI | 8888:80 | Yes (depends on DB) |
mailpit | Email testing tool (SMTP + web UI) | 1025:1025, 8025:8025 | Yes |
git clone git@github.com:supravatm/laravel-v12-api-starter.git
cd laravel-v12-api-starter
docker run --rm -v "$(pwd)":/app composer install
Update your .env
file for database credential:
DB_CONNECTION=mysql
DB_HOST=database
DB_PORT=3306
DB_DATABASE=database
DB_USERNAME=user
DB_PASSWORD=password
docker-compose up -d
Note: Some containers wait for the database service to be healthy before starting.
Run the following initialization commands:
docker-compose exec app php artisan key:generate
docker-compose exec app php artisan optimize
docker-compose exec app php artisan session:table
docker-compose exec app php artisan migrate
docker-compose exec app php artisan cache:clear
- App (Nginx): http://localhost
- phpMyAdmin: http://localhost:8888
- Use DB credentials from your
.env
file.
- Use DB credentials from your
- Mailpit UI: http://localhost:8025
- SMTP:
localhost:1025
(for development email delivery)
- SMTP:
Mailpit is use for email testing. It stores messages and provides a web interface to view sent emails.
No extra configuration needed for Laravel; just set the following in your .env
:
MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
Complete REST API Documentation can be found here
- Ensure Docker Desktop (or Docker Engine) is running.
- If containers fail to start, use
docker-compose logs
for details. - Database and phpMyAdmin may take a moment to become healthy.