定制 bnf/service-provider-bridge-bundle 二次开发

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

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

bnf/service-provider-bridge-bundle

Composer 安装命令:

composer require bnf/service-provider-bridge-bundle

包简介

This Symfony Bundle allows Symfony applications to use service providers as defined in container-interop/service-provider

README 文档

README

Scrutinizer Code Quality Build Status Coverage Status

container-interop/service-provider bridge bundle

Import service-provider as defined in container-interop into a Symfony application.

This is a fork of thecodingmachine/service-provider-bridge-bundle to support Symfony 4. Credits go to David Négrier.

Usage

Installation

Add Bnf\Interop\ServiceProviderBridgeBundle\InteropServiceProviderBridgeBundle in your kernel (the app/AppKernel.php file).

AppKernel.php

    public function registerBundles()
    {
        $bundles = [
            ...
            new \Bnf\Interop\ServiceProviderBridgeBundle\InteropServiceProviderBridgeBundle()
        ];
        ...
    }

Usage

You have to declare service providers manually in the constructor of the bundle.

AppKernel.php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            ...
            new \Bnf\Interop\ServiceProviderBridgeBundle\InteropServiceProviderBridgeBundle([
                new MyServiceProvide1(),
                new MyServiceProvide2()
            ])
        ];
        ...
    }
}

Alternatively, you can also pass the service provider class name. This is interesting because the service-provider bundle will not instantiate the service provider unless it is needed for a service. You can therefore improve performances of your application.

AppKernel.php

    public function registerBundles()
    {
        $bundles = [
            ...
            new \Bnf\Interop\ServiceProviderBridgeBundle\InteropServiceProviderBridgeBundle([
                MyServiceProvide1::class,
                MyServiceProvide2::class
            ])
        ];
        ...
    }

Finally, if you need to pass parameters to the constructors of the service providers, you can do this by passing an array:

AppKernel.php

    public function registerBundles()
    {
        $bundles = [
            ...
            new \Bnf\Interop\ServiceProviderBridgeBundle\InteropServiceProviderBridgeBundle([
                [ MyServiceProvide1::class, [ "param1", "param2" ] ],
                [ MyServiceProvide2::class, [ 42 ] ],
            ])
        ];
        ...
    }

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-09-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固