leads / core
Shared core library for Leads
Installs: 3 203
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=8.3
- doctrine/dbal: ^4.0
- symfony/config: ^7.2
- symfony/dependency-injection: ^7.2
- symfony/http-kernel: ^7.2
- symfony/validator: ^7.2
This package is auto-updated.
Last update: 2025-07-30 09:17:21 UTC
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