sirix/project-template
最新稳定版本:0.0.5
Composer 安装命令:
composer require sirix/project-template
包简介
Sirix Template for Microservices
README 文档
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.
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-11