承接 draw/dependency-injection 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

draw/dependency-injection

最新稳定版本:0.36.0

Composer 安装命令:

composer require draw/dependency-injection

包简介

Dependency injection addons to Symfony

README 文档

README

This package provides addons to the Symfony Dependency Injection component.

Installation

composer require draw/dependency-injection 

Integration

The Draw\Component\DependencyInjection\Integration namespace contains classes that can be used to easily integrate subcomponents into a main bundle.

An example of this is all the draw components that are integrated into the DrawFrameworkExtraBundle.

When creating the main bundle extension you can use the IntegrationTrait to easily integrate all the subcomponents.

namespace Example\Bundle\MyBundle\DependencyInjection; use Draw\Component\DependencyInjection\IntegrationTrait; use Example\Component\MyComponent\DependencyInjection\MyCompnentIntegration; use Example\Component\MyOtherComponent\DependencyInjection\MyOtherComponentIntegration; class ExampleMyBundle extends Bundle { use ExtendableExtensionTrait; public function __construct() { $this->registerDefaultIntegrations(); } private function provideExtensionClasses(): array { return [ MyCompnentIntegration::class, ]; } public function getConfiguration(array $config, ContainerBuilder $container): ConfigurationInterface { return new Configuration($this->integrations); } public function load(array $configs, ContainerBuilder $container): void { $config = $this->loadIntegrations($configs, $container); // Do your bundle specific configuration here } public function prepend(ContainerBuilder $container): void { $this->prependIntegrations($container, 'example_my_bundle'); } }

registerDefaultIntegrations

The registerDefaultIntegrations method will automatically register all the integrations that are in the provideExtensionClasses method.

It will check if the class exists and if it does it will create a new instance of it and add it to the integrations property.

That way you can define the integration classes in the specific component, and it will automatically be integrated into the main bundle if your component is installed.

loadIntegrations

The loadIntegrations method will call the load method on all the integrations that are registered.

It will automatically pass the configuration to the existing configuration only if they are enabled.

prependIntegrations

The prependIntegrations method will call the prepend method on all the integrations that are registered.

It will check if the configuration is enabled and if it is it will call the prepend method.

Configuration

Here is an example of configuration base on the example above.

example_my_bundle: my_component: enabled: true my_component_configuration: true my_other_component: enabled: false

This example will enable the MyComponentIntegration and disable the MyOtherComponentIntegration.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固