yceruto/decorator-bundle
最新稳定版本:v1.2.3
Composer 安装命令:
composer require yceruto/decorator-bundle
包简介
Symfony framework integration of the Decorator library
关键字:
README 文档
README
Symfony framework integration of the yceruto/decorator library.
- Enables decoration capabilities for Symfony controllers and Messenger handlers.
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:
formatthe serialization format (default: json)contextthe serialization contextstatusthe response status (default: 200)headersthe response headers
Example:
class MyController { #[Serialize] public function __invoke(): array { return ['success' => true]; } }
Supported Features for Using Decorators
The following features currently support the use of decorators in your application:
- Controllers
- Messenger Handlers (when
symfony/messengeris installed)
License
This software is published under the MIT License
统计信息
- 总下载量: 27
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-05