Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Cqs Routing Laravel Package

digital-craftsman/cqs-routing

View on GitHub
Deep Wiki
Context7

Configuration

Every option in the configuration is optional. Not defining a default for request decoder, DTO constructor or response constructor will lead to an exception when there is no component defined in the route.

<?php

declare(strict_types=1);

use App\Application\CQSRouting\DTOValidator\AccessValidator;
use App\Application\CQSRouting\DTOValidator\DTO\AccessValidatorParameters;
use App\Application\CQSRouting\HandlerWrapper\ConnectionTransactionWrapper;
use DigitalCraftsman\CQSRouting\DTOConstructor\SerializerDTOConstructor;
use DigitalCraftsman\CQSRouting\RequestDecoder\JsonRequestDecoder;
use DigitalCraftsman\CQSRouting\ResponseConstructor\EmptyJsonResponseConstructor;
use DigitalCraftsman\CQSRouting\ResponseConstructor\SerializerJsonResponseConstructor;
use Symfony\Component\DependencyInjection\Loader\Configurator\App;

return App::config([
    'cqs_routing' => [
        'query' => [
            'default_request_validator_classes' => [
                GuardAgainstTokenInHeaderRequestValidator::class => null,
            ],
            'default_request_decoder_class' => JsonRequestDecoder::class,
            'default_request_data_transformer_classes' => [
                AddActionIdRequestDataTransformer::class => null,
            ],
            'default_dto_constructor_class' => SerializerDTOConstructor::class,
            'default_dto_validator_classes' => [
                CourseIdValidator::class => null,
                UserIdValidator::class => null,
            ],
            'default_handler_wrapper_classes' => [
                ConnectionTransactionWrapper::class => null,
            ],
            'default_response_constructor_class' => SerializerJsonResponseConstructor::class,
        ],
        'command' => [
            'default_request_validator_classes' => [
                GuardAgainstTokenInHeaderRequestValidator::class => null,
            ],
            'default_request_decoder_class' => JsonRequestDecoder::class,
            'default_request_data_transformer_classes' => [
                AddActionIdRequestDataTransformer::class => null,
            ],
            'default_dto_constructor_class' => SerializerDTOConstructor::class,
            'default_dto_validator_classes' => [
                CourseIdValidator::class => null,
                UserIdValidator::class => null,
            ],
            'default_handler_wrapper_classes' => [
                ConnectionTransactionWrapper::class => null,
            ],
            'default_response_constructor_class' => EmptyJsonResponseConstructor::class,
        ],
    ],
]);

Or if your configuration still uses yaml, it looks like this:

cqs_routing:

  command:

    # Classes of the default request validator of command controller when there is none defined for the route
    default_request_validator_classes:
      'App\CQSRouting\RequestValidator\GuardAgainstTokenInHeaderRequestValidator': null

    # Class of the default request decoder of command controller when there is none defined for the route
    default_request_decoder_class: 'DigitalCraftsman\CQSRouting\RequestDecoder\JsonRequestDecoder'

    # Classes of the default request data transformer of command controller when there is none defined for the route
    default_request_data_transformer_classes:
      'App\CQSRouting\RequestDataTransformer\AddActionIdRequestDataTransformer': null
    
    # Class of the default DTO constructor of command controller when there is none defined for the route
    default_dto_constructor_class: 'DigitalCraftsman\CQSRouting\DTOConstructor\SerializerDTOConstructor'

    # Classes of the default DTO validator of command controller when there is none defined for the route
    default_dto_validator_classes:
      'App\CQSRouting\DTOValidator\CourseIdValidator': null
      'App\CQSRouting\DTOValidator\UserIdValidator': null

    # Classes of the default wrapper handler of command controller when there is none defined for the route
    default_handler_wrapper_classes:
      'App\CQSRouting\HandlerWrapper\ConnectionTransactionWrapper': null

    # Class of the default response constructor of command controller when there is none defined for the route
    default_response_constructor_class: 'DigitalCraftsman\CQSRouting\ResponseConstructor\EmptyJsonResponseConstructor'

  query:

    # Classes of the default request validator of query controller when there is none defined for the route
    default_request_validator_classes:
      'App\CQSRouting\RequestValidator\GuardAgainstTokenInHeaderRequestValidator': null
    
    # Class of the default request decoder of query controller when there is none defined for the route
    default_request_decoder_class: 'DigitalCraftsman\CQSRouting\RequestDecoder\JsonRequestDecoder'

    # Classes of the default request data transformer of query controller when there is none defined for the route
    default_request_data_transformer_classes:
      'App\CQSRouting\RequestDataTransformer\AddActionIdRequestDataTransformer': null
    
    # Class of the default DTO constructor of query controller when there is none defined for the route
    default_dto_constructor_class: 'DigitalCraftsman\CQSRouting\DTOConstructor\SerializerDTOConstructor'
    
    # Classes of the default DTO validator of query controller when there is none defined for the route
    default_dto_validator_classes:
      'App\CQSRouting\DTOValidator\CourseIdValidator': null
      'App\CQSRouting\DTOValidator\UserIdValidator': null

    # Classes of the default wrapper handler of query controller when there is none defined for the route
    default_handler_wrapper_classes:
      'App\CQSRouting\HandlerWrapper\ConnectionTransactionWrapper': null
    
    # Class of the default response constructor of query controller when there is none defined for the route
    default_response_constructor_class: 'DigitalCraftsman\CQSRouting\ResponseConstructor\SerializerJsonResponseConstructor'
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium