Archist is a lightweight bash utility designed to scaffold Clean Architecture directory structures for PHP projects in seconds. It organizes your code into layers, making it decoupled, testable, and easy to maintain.
Archist generates a professional layout following the "Screaming Architecture" principle:
src/Domain: The heart of your app. Contains Entities, Value Objects, and Repository Interfaces. No external dependencies.src/Application: Orchestration layer. Contains Use Cases, DTOs, and Application Services.src/Infrastructure: Implementation details.Persistence: Database logic (Eloquent, Doctrine, PDO).Delivery: Entry points for the application (Http for Web, Console for CLI).ExternalApi: Third-party service integrations.tests/: Dedicated space for Unit and Integration tests.public/: Web server document root. Contains theindex.phpfront controller.
This is the resulting structure after running Archist:
.
├── composer.json
├── public/
│ └── index.php
├── src/
│ ├── Application/
│ │ ├── DTO/
│ │ ├── Service/
│ │ └── UseCase/
│ ├── Domain/
│ │ ├── Entity/
│ │ ├── Exception/
│ │ ├── Repository/
│ │ └── ValueObject/
│ ├── Infrastructure/
│ │ ├── Delivery/
│ │ │ ├── Console/
│ │ │ └── Http/
│ │ ├── ExternalApi/
│ │ └── Persistence/
│ └── Shared/
└── tests/
├── Integration/
└── Unit/
curl -O https://raw.githubusercontent.com/AFelipeTrujillo/php-archist/v1.3.1/archist.sh
chmod +x archist.sh
./archist.sh
If you have the archist.sh file in your machine:
- Grant execution permissions:
chmod +x archist.sh
- Run the script:
./archist.sh
Note: Windows users should use Git Bash or WSL.
- Interactive CLI: Added prompts to customize project name, description, type, and license.
- Dynamic Composer: Automatic generation of
composer.jsonwith PSR-4 autoloading forApp\andTests\. - Environment Support: Optional integration of
vlucas/phpdotenvwith automatic.envand.env.examplecreation. - Infrastructure Refactor: Implemented a "Delivery" sub-layer to clearly separate
HttpandConsoleentry points. - Safety Check: Added a vendor validation guard in
public/index.phpto guide users who forget to run composer install.
- Feature: Added interactive project configuration (Name, Type, License).
- Feature: Automatic composer.json generation with PSR-4 mapping.
- Improvement: Added autoload validation in index.php.
- Feature: Added
tests/directory (Unit & Integration). - Architecture: Refactored Infrastructure to include
Delivery(Http/Console) for multiple entry points. - Enhancement: Added ASCII Logo to the CLI output.
- Enhancement: Improved
public/index.phpwith initial boilerplate.
- Initial Release: Core Clean Architecture scaffolding.
- Added
Domain,Application, andInfrastructurelayers. - Added
.gitkeepsupport for tracking empty directories.
This project is licensed under the MIT License.