The missing dependency injection for OXID eShop
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Fixed sometimes has try `scandir()` a file. Version 0.1.3 Feb 16, 2019
tests Fixed sometimes has try `scandir()` a file. Version 0.1.3 Feb 16, 2019
.gitignore Base code Jan 26, 2019
CHANGELOG.md Fixed sometimes has try `scandir()` a file. Version 0.1.3 Feb 16, 2019
LICENSE
README.md Version 0.1.2 Feb 16, 2019
composer.json New Feature: write you service collection with tags @see https://symf… Feb 16, 2019
composer.lock Better it is to Test symfony/dependency-injection in the same Version… Feb 16, 2019
function_project_container.php Renamed services.yaml, as it is called in the Symfony Framework. Feb 16, 2019

README.md

Dependency Injection

The missing dependency injection for OXID eShop

Install

composer require "oxidprojects/dependency-injection"

How to use:

  1. Create services.yaml in a module: (eg. source/modules/tm/Sunshine/services.yaml)

    services:
      tm\ModuleOutput:
        class: 'tm\ModuleOutput'
  2. 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