sirix / project-template
Sirix Template for Microservices
0.0.2
2025-05-17 10:03 UTC
Requires
- php: ~8.4.0
- cakephp/chronos: ^3.1
- composer/package-versions-deprecated: ^1.10.99
- enqueue/amqp-lib: ^0.10.19
- enqueue/rdkafka: ^0.10.20
- guzzlehttp/guzzle: ^7.9
- laminas/laminas-cli: ^1.11
- laminas/laminas-component-installer: ^3.5
- laminas/laminas-config-aggregator: ^1.17
- laminas/laminas-diactoros: ^3.5.0
- laminas/laminas-servicemanager: ^3.23
- laminas/laminas-stdlib: ^3.20
- mezzio/mezzio: ^3.20
- mezzio/mezzio-helpers: ^5.17
- mezzio/mezzio-laminasrouter: ^3.10
- sirix/cycle-orm-factory: ^2.1
- sirix/money: ^1.0
- sirix/monolog: ^1.0
- sirix/sirix-config: ^1.0
- symfony/cache: ^7.2
- vjik/cycle-typecast: ^2.2
- yiisoft/validator: ^2.1
Requires (Dev)
- ergebnis/composer-normalize: ^2.45
- filp/whoops: ^2.16
- laminas/laminas-development-mode: ^3.13.0
- mezzio/mezzio-tooling: 2.10.x-dev
- phpunit/phpunit: ^11.5
- qossmic/deptrac: ^2.0
- roave/security-advisories: dev-master
README
Example service that should be used as a starting point for new projects.
This template uses PHP (≥ 8.4) and integrates several libraries and frameworks out of the box, including:
- Mezzio (PSR-15 middleware framework)
- Laminas (components for service management, configuration, etc.)
- Cycle ORM (for database interactions)
- Monolog (for logging)
- PHPUnit (for testing)
- Code quality tools (PHPStan, Rector, PHP-CS-Fixer, Deptrac)
The project is built on a modular architecture and consists of the following modules:
- ApiGateway (handles API requests and routing)
- Common (contains shared functionality)
- ExampleModule (demonstrates module implementation)
The modules apply the principle of clean architecture, they are divided into layers:
- App (Application layer - contains use cases and application services)
- Domain (Domain layer - contains business logic, entities, and domain services)
- Infra (Infrastructure layer - contains implementations of repositories, external services, etc.)
Getting Started
Requirements
- PHP 8.4 or higher
- Composer
Creating a New Project
Create a new project based on this template:
composer create-project sirix/project-template my-new-project-name --ignore-platform-reqs
Available Commands
Development Mode
- Enable development mode:
composer development-enable
- Disable development mode:
composer development-disable
- Check development mode status:
composer development-status
Mezzio Commands
- Show all available Mezzio commands:
composer mezzio
# or
./vendor/bin/laminas
Database Commands
- Run database migrations:
./vendor/bin/laminas cycle:migrator:run
- Rollback database migrations:
./vendor/bin/laminas cycle:migrator:rollback
- Create a new migration:
./vendor/bin/laminas cycle:migrator:create PascalCaseMigrationName
- Create a new database seed:
./vendor/bin/laminas cycle:seed:create PascalCaseSeedName
- Run database seeds:
./vendor/bin/laminas cycle:seed
- Clear Cycle ORM cache:
./vendor/bin/laminas cycle:cache:clear
Code Quality Commands
- Run all code quality checks and tests:
composer check
- Check code style:
composer cs-check
- Fix code style:
composer cs-fix
- Run Rector (static analysis and automatic refactoring):
composer rector
- Run PHPStan (static analysis):
composer phpstan
- Run Deptrac to check layer dependencies:
composer deptrac-layers
- Run Deptrac to check module dependencies:
composer deptrac-modules
Testing Commands
- Run tests:
composer test
- Run tests with coverage report:
composer test-coverage
Server Commands
- Start development server:
composer serve
Utility Commands
- Clear config cache:
composer clear-config-cache
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the composer.json file for details.