zajca / symfony-extensions
Variety extensions for symfony.
dev-main
2021-10-12 13:48 UTC
Requires
- php: >=8.0
- symfony/dependency-injection: ^5.3|<6
- symfony/framework-bundle: ^5.3|<6
- symfony/http-kernel: ^5.3|<6
- symfony/property-access: ^5.3|<6
- symfony/property-info: ^5.3|<6
- symfony/routing: ^5.3|<6
- symfony/serializer: ^5.3|<6
- symfony/string: ^5.3|<6
- symfony/uid: ^5.3|<6
- symfony/validator: ^5.3|<6
- webmozart/assert: ^1.10
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3
- phpstan/phpstan: ^0.12
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-04-12 19:18:22 UTC
README
This library contains a variety of extensions to ease work with Symfony framework
Install
Use composer to install the lib from packagist.
composer require zajca/symfony-extensions
Usage
Exception
Basic exception handling for http kernel.
Two Exception exists extending Exception interface: Zajca\Extensions\Exception\ExceptionInterface
Zajca\Extensions\Exception\InternalException
- Exception which will return 500 status code but will log more information than standard ExceptionZajca\Extensions\Exception\PublicException
- Exception which will be serialized and shown to api consumer
Usage in symfony
Register exception listener and use/extend predefined exceptions
services: Zajca\Extensions\Exception\ExceptionListener: tags: - { name: kernel.event_listener, event: kernel.exception }
Request mapping
Argument value resolver more in symfony docs which will map user input from request to object.
Examples
For examples check the tests: Zajca\Extensions\Tests\RequestMapping\ArgumentValueResolver\Example\ControllerStub