yceruto/decorator-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

yceruto/decorator-bundle

最新稳定版本:v1.2.3

Composer 安装命令:

composer require yceruto/decorator-bundle

包简介

Symfony framework integration of the Decorator library

README 文档

README

GitHub Actions Workflow Status Version PHP GitHub License

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:

  • format the serialization format (default: json)
  • context the serialization context
  • status the response status (default: 200)
  • headers the 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/messenger is installed)

License

This software is published under the MIT License

统计信息

  • 总下载量: 27
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-05