2017 © Pedro Peláez
 

library ray-di-bundle

image

ttskch/ray-di-bundle

  • Monday, September 26, 2016
  • by ttskch
  • Repository
  • 1 Watchers
  • 2 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

TtskchRayDiBundle

Build Status Latest Stable Version Total Downloads, (*1)

Integration of Ray.Di into Symfony., (*2)

Getting started

1. Composer-require

$ composer require ttskch/ray-di-bundle

2. Register with AppKernel

// app/AppKernel.php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...
            new Ttskch\RayDiBundle\TtskchRayDiBundle(),
        ];
        // ...
    }
    // ...
}

3. Configure via config.yml

# app/config/config.yml

ttskch_ray_di:
    module_class: 'Foo\BarModule'   # FQCN of your main Ray.Di `module`

Usage

When you configure your module..., (*3)

class AppModule extends AbstractModule
{
    public function configure()
    {
        $this->bind(SomeServiceInterface::class)->to(SomeServiceConcrete::class);
    }
}

Then you can get injector from Symfony container like as below:, (*4)

class SomeController extends Controller
{
    public function indexAction()
    {
        /** @var \Ray\Di\Injector $injector */
        $injector = $this->get('ttskch_ray_di.injector');

        $someService = $injector->getInstance(SomeServiceInterface::class);

        return new Response($someService->someMethod());
    }
}

The Versions

26/09 2016

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires