This project provides a clear implementation of Clean Architecture principles in PHP, ensuring a well-structured and maintainable codebase. It guides developers through creating clean, organized applications by defining architectural levels and checking dependencies. Perfect for PHP developers looking to enhance their architectural understanding.
The php-clean-architecture package provides a robust implementation of Clean Architecture for PHP projects, adhering to the architectural principles as outlined by Robert C. Martin (Uncle Bob). The goal is to create a well-structured and maintainable codebase by clearly defining architecture levels and their dependencies.
For a detailed explanation of Clean Architecture, refer to Clean Architecture.
Architecture Levels: The architecture is divided into distinct levels:
Use Case Definition: Each use case should represent a specific action, such as login or registration, ensuring clear and focused functionality within the application.
Developers can easily start using the package by following these core commands, which require configuration through the provided YAML files after installation:
vendor/bin/php-clean-architecture make:entity EntityName
vendor/bin/php-clean-architecture make:repository RepositoryName
vendor/bin/php-clean-architecture make:usecase UseCaseName
vendor/bin/php-clean-architecture make:controller ControllerName
vendor/bin/php-clean-architecture make:service ServiceName
Integrating the architecture checks into Continuous Integration/Continuous Deployment (CI/CD) pipelines is straightforward. The following command verifies whether the architecture adheres to the defined structure before deployment:
vendor/bin/php-clean-architecture check
To create a new entity, repository, use case, controller, or service, execute:
vendor/bin/php-clean-architecture make:entity SomeEntity
vendor/bin/php-clean-architecture make:repository SomeRepository
vendor/bin/php-clean-architecture make:usecase SomeUseCase
vendor/bin/php-clean-architecture make:controller SomeController
vendor/bin/php-clean-architecture make:service SomeService
The php-clean-architecture package aids in building scalable and maintainable PHP applications by enforcing a clean architecture. It encourages developers to adhere to the rules of architecture, potentially enhancing the overall quality of the codebase. For more information, review the full documentation available in the repository.
No comments yet.
Sign in to be the first to comment.