Laravel API SOLID Boilerplate is a production-ready starter kit for secure, scalable Laravel APIs. Built on SOLID principles, it includes automated CRUD scaffolding, Passport OAuth2 authentication, Dockerized environments, and a CI pipeline that enforces code quality before every commit. Start new projects in hours, not weeks β with confidence your base is built to last.
- Features
- Quick Start
- Enhanced CRUD Generation
- Code Quality & Pre-commit Hooks
- Docker Environment
- Authentication
- Frontend Integration
- Documentation
- Version History
ποΈ SOLID Architecture
- Repository pattern with service layer separation
- Dependency injection and interface-based design
- Clean, maintainable, and testable code structure
β‘ Enhanced CRUD Generation
make:structure
command with selective generation (--only
,--no-resource
)make:route-group
for organized API endpoints- Modern PHP 8.2+ syntax with constructor property promotion
π Laravel Passport Integration
- OAuth2 authentication out of the box
- Automated setup scripts
- API token management
π³ Professional Docker Setup
- Separate development and production environments
- PostgreSQL, Redis, MailHog integration
- Optimized for cloud deployment
π§ Comprehensive Code Quality
- Pre-commit hooks: PHPStan, Pint, PHPUnit, security audit
- Automated testing with coverage reports
- Markdown linting and secret detection
π Workflow Automation
- Complete Makefile with 30+ commands
- One-command setup and deployment
- Integrated development tools
# Clone and setup
git clone <repository-url>
cd laravel-api-solid
# One-command setup (includes Docker, dependencies, migrations, Passport)
make setup
# Start development environment
make dev
# Access workspace for Laravel commands
make shell
Your API will be available at http://localhost:8000
with MailHog at http://localhost:8025
.
# Configure environment
cp .env.prod .env
nano .env # Edit production settings
# Deploy
make prod-build
# Development
make dev # Start development environment
make shell # Access workspace container
make migrate # Run database migrations
make test # Run test suite
make code-quality # Run all quality checks
# Code Quality
make phpstan # Static analysis
make code-style # Fix code formatting
make test-coverage # Tests with coverage
make security-audit # Security scan
# Passport
make passport-setup # Complete Passport setup
make passport-client # Create OAuth client
Powerful Artisan commands for rapid API development with SOLID architecture.
# Generate complete CRUD structure
php artisan make:structure User
# Selective generation (only specific methods)
php artisan make:structure Post --only=index,show,store
# Skip resource folder creation
php artisan make:structure Category --no-resource
# Generate organized route groups
php artisan make:route-group Api/V1/Users
- Repository & Interface: Data access layer with contracts
- Service Classes: Business logic separation (Create, Read, Update, Delete)
- Controller: Clean, dependency-injected API controller
- Resources: API response transformers (optional)
- Routes: Organized route groups with automatic registration
π Complete Documentation - Detailed examples and advanced usage
Comprehensive automated code quality enforcement with pre-commit hooks.
- PHPStan: Static analysis and type checking
- Laravel Pint: Code style formatting
- PHPUnit: Automated testing with coverage
- Composer Audit: Security vulnerability scanning
- Secret Detection: Prevent credential commits
- Markdown Linting: Documentation quality
# Setup pre-commit hooks (included in make setup)
make setup-pre-commit
# Manual quality checks
make full-quality-check # Complete analysis
make phpstan # Static analysis only
make code-style # Fix formatting
make test-coverage # Tests with coverage
make security-audit # Security scan
Pre-commit hooks automatically run on every commit, ensuring consistent code quality across the team.
π Pre-commit Setup Guide | π Code Quality Tools
Professional Docker setup with separate development and production configurations.
- PostgreSQL: Primary database
- Redis: Caching and sessions
- MailHog: Email testing
- Workspace: Full development environment with tools
- Nginx: Web server
- PHP-FPM: Optimized PHP processing
- PostgreSQL: Production database
- Redis: Production caching
# Development
make dev # Start development stack
make shell # Access workspace
make db-shell # Access PostgreSQL
# Production
make prod-build # Build and deploy production
make prod-logs # View production logs
π Complete Docker Documentation
Laravel Passport OAuth2 implementation with automated setup.
- OAuth2 server with personal access tokens
- API authentication middleware
- Automated client and key generation
- Production-ready configuration
# Automatic setup (included in make setup)
make passport-setup
# Manual setup
make passport-install
make passport-keys
make passport-client
π Passport Setup Guide
Modern frontend development with Vue.js or React, featuring Inertia.js for seamless full-stack integration.
# Setup Vue 3 with Inertia.js
make setup-vue
# Setup React 18 with Inertia.js
make setup-react
# Start development environment
make dev
Vue.js 3 Stack:
- Vue 3 with Composition API
- Pinia for state management
- Vue Router for client-side routing
- Vitest for testing
React 18 Stack:
- React 18 with hooks
- Redux Toolkit for state management
- React Router for client-side routing
- Jest for testing
Shared Technologies:
- Inertia.js for server-side routing
- Vite for fast development and building
- Tailwind CSS for styling
- TypeScript support
- Headless UI components
- Docker integration
# Access workspace for frontend development
make shell
# Inside workspace:
npm run dev # Start Vite dev server with HMR
npm run build # Build for production
npm run test # Run component tests
npm run lint # Lint and format code
npm run type-check # TypeScript checking
π Complete Frontend Documentation - Comprehensive guides for Vue.js, React, setup, deployment, and advanced configuration
Comprehensive guides available in the docs/
directory:
- Architecture Guide - SOLID principles and project structure
- Service Repository Pattern - Implementation details
- Route Generation - CRUD command reference
- Passport Setup - OAuth2 authentication
- Frontend Documentation - Complete frontend development guide
- Vue.js Setup - Vue 3 + Inertia.js integration
- React Setup - React 18 + Inertia.js integration
- Switching Frameworks - Migration between Vue and React
- Advanced Configuration - Vite, Docker, and optimization
- Deployment Guide - Production deployment strategies
- DevOps Guide - Docker and deployment
- Code Quality Tools - Quality automation
- Pre-commit Setup - Hook configuration
π Documentation Index
License: MIT | PHP: 8.2+ | Laravel: 12.0+