Start building your APIs in PHP effortlessly with this robust and feature-rich template! 🎉 Designed to save time while encouraging best practices, this template includes a static code analyzer, helpful utility classes, and a clean architecture to keep your code organized and maintainable. 🌟
- Best Practices: Follows PHP standards and clean coding principles.
- Static Code Analysis: Integrated with PHPStan (standalone
.phar) for detecting code issues early. - Hexagonal Architecture: Promotes scalability and maintainability.
- SOLID Principles: Ensures strong, reliable design patterns.
- Environment Validation: Automatic validation of required env vars and boolean types via
Envsclass. - Security: CORS origin control, secure cookies, JWT authentication middleware.
- Utility Classes: Packed with reusable and helpful classes to jumpstart development.
- PHPStan – Static code analyzer (standalone
.phar, not a Composer dependency). - vlucas/phpdotenv – Environment variable management.
- firebase/php-jwt – JSON Web Token encoding/decoding.
- PHP 8.0 or higher.
Clone the repository and run:
make installThis will automatically download composer.phar if not present and install all dependencies.
All available commands are defined in the Makefile. Check it for deployment, static analysis, dependency management and more. 📦
Copy .env.example to .env and fill in the required values:
cp .env.example .envOr simply run make env_example which will create the .env from .env.example if it doesn't exist.
Required environment variables: DEV_MODE, COOKIE_SECURE, CORS_ORIGIN. Check .env.example for all available options.
Contributions are welcome! If you'd like to improve this template or suggest new features, feel free to open an issue or submit a pull request. 🙌
Before contributing, ensure your code follows PHP coding standards and passes make check.
This project is licensed under the MIT License. Feel free to use, modify, and distribute it as you see fit. 😊