oxidprojects/dependency-injection
Composer 安装命令:
composer require oxidprojects/dependency-injection
包简介
The missing dependency injection for OXID eShop
README 文档
README
The missing dependency injection for OXID eShop
Install
composer require "oxidprojects/dependency-injection"
How to use:
-
Create
services.yamlin a module: (eg.source/modules/tm/Sunshine/services.yaml)services: tm\ModuleOutput: class: 'tm\ModuleOutput'
-
project_container()is a global function.<?php class Controller extends FrontendController { public function render() { $output = project_container()->get(ModuleOutput::class); $this->addTplParam('title', $output->html('Hello dependency injection')); return 'template'; } }
Weblinks
- You have all the Power of Symfony Service Container.
- See which other methods are available to inject classes. You must not use every time the
__construct()method.
统计信息
- 总下载量: 1.72k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2019-01-27