leads/core
最新稳定版本:0.0.14
Composer 安装命令:
composer require leads/core
包简介
Shared core library for Leads
README 文档
README
Lead core bundle for the Symfony Framework
Installation
Install the latest version with
composer require leads/core
CommandBus
<?php declare(strict_types=1); use Leads\Core\CommandBus\CommandInterface; final readonly class ExampleCommand implements CommandInterface { }
<?php declare(strict_types=1); use Leads\Core\CommandBus\CommandValidatorInterface; use Leads\Core\CommandBus\CommandInterface; use Leads\Core\CommandBus\AsCommandValidator; /** * @implements CommandValidatorInterface<ExampleCommand> */ #[AsCommandValidator(commandClass: ExampleCommand::class)] final readonly class Validator1 implements CommandValidatorInterface { /** * @param ExampleCommand $command */ public function validate(CommandInterface $command): void { // validate command } }
<?php declare(strict_types=1); use Leads\Core\CommandBus\HandlerInterface; use Leads\Core\CommandBus\AsCommandHandler; /** * @implements HandlerInterface<ExampleCommand> */ #[AsCommandHandler(commandClass: ExampleCommand::class)] class ExampleHandler implements HandlerInterface { /** * @param ExampleCommand $command */ public function handle(CommandInterface $command) { // handle command } }
Exception
- Leads\Core\Exception\EntityNotFoundException.php
Pagination
<?php declare(strict_types=1); use Leads\Core\Pagination\Pagination; use Leads\Core\Pagination\DBALPagination; use Doctrine\DBAL\Connection; class ExampleRepository { public function __construct( private Connection $connection, ) { } public function find(int $page, int $perPage) { // create Doctrine\DBAL\Query\QueryBuilder $qb $pagination = (new Pagination( page: 1, perPage: 10, pagination: new DBALPagination( connection: $this->connection, qb: $qb, ), ))->paginate(); } }
BaseAction
Adds a basic function for validating request api and template responses.
See methods of the BaseAction.php class
统计信息
- 总下载量: 7.08k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-19