yceruto / decorator-bundle
Symfony framework integration of the Decorator library
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=8.2
- symfony/framework-bundle: ^6.4|^7.0
- yceruto/decorator: ^1.1
Requires (Dev)
- doctrine/doctrine-bundle: ^2.13
- doctrine/orm: ^3.2
- friendsofphp/php-cs-fixer: ^3.64
- phpunit/phpunit: ^11.3
- symfony/browser-kit: ^7.1
- symfony/mime: ^7.1
- symfony/serializer: ^7.1
- symfony/yaml: ^7.1
This package is auto-updated.
Last update: 2024-11-04 04:51:58 UTC
README
Symfony framework integration of the yceruto/decorator
library.
- Enables decoration capabilities for Symfony controllers.
Installation
Open a command console, enter your project directory and execute:
$ composer require yceruto/decorator-bundle
Native Decorators
- Compound
See https://github.com/yceruto/decorator README.md
file for details.
Bundle Decorators
Transactional
A Doctrine ORM decorator that wraps persistence method operations within a single Doctrine transaction. In case you're using multiple entity managers, you can pass the name of the entity manager as parameter.
Example:
class MyController { #[Transactional(name: 'secondary')] public function __invoke(Request $request): Response { // multiple persistence operations... } }
Serialize
A Serializer decorator that encode the result of your controller into a specific format (default: json).
Options:
format
the serialization format (default: json)context
the serialization contextstatus
the response status (default: 200)headers
the response headers
Example:
class MyController { #[Serialize] public function __invoke(): array { return ['success' => true]; } }
License
This software is published under the MIT License