定制 symplify/default-autowire 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

symplify/default-autowire

最新稳定版本:v2.0.0-RC2

Composer 安装命令:

composer require symplify/default-autowire

包简介

Adds autowire to services when needed.

README 文档

README

Build Status Code Coverage Downloads

This bundle turns on autowire for you!

It turns this:

# app/config/config.yml
services:
    PriceCalculator:
        autowire: true

    ProductRepository:
        autowire: true

    UserFactory:
        autowire: true

Into this:

# app/config/config.yml
services:
    PriceCalculator: ~
    ProductRepository: ~
    UserFactory: ~

Install

composer require symplify/default-autowire

Add bundle to AppKernel.php:

final class AppKernel extends Kernel
{
    public function registerBundles(): array
    {
        $bundles = [
            new Symplify\DefaultAutowire\SymplifyDefaultAutowireBundle(),
            // ...
        ];
    }
}

And that's it!

Features

Multiple service of one type? Set preferred one

In case you have multiple connections, entity managers or decorated service, you can set default preferred service (name) for each type (class or interface).

To make it easier for you, there are few default values. You can change them or add new ones.

# app/config/cofing.yml
symplify_default_autowire:
    autowire_types:
        Doctrine\ORM\EntityManager: 'doctrine.orm.default_entity_manager'
        Doctrine\ORM\EntityManagerInterface: 'doctrine.orm.default_entity_manager'
        Doctrine\Portability\Connection: 'database_connection'
        Symfony\Component\EventDispatcher\EventDispatcher: 'event_dispatcher'
        Symfony\Component\EventDispatcher\EventDispatcherInterface: 'event_dispatcher'
        Symfony\Component\Translation\TranslatorInterface: 'translator'

Contributing

Send issue or pull-request to main repository.

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-01-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固