2017 © Pedro Peláez
 

nette-addon nette-injects-extension

Nette Framework DI extension for injecting services into other services' properties.

image

majkl578/nette-injects-extension

Nette Framework DI extension for injecting services into other services' properties.

  • Thursday, December 12, 2013
  • by Majkl578
  • Repository
  • 3 Watchers
  • 4 Stars
  • 52 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 5 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Service injects for Nette 2.1+

Nette Framework DI extension for injecting services into other services' properties., (*1)

Motivation

Writing constructor/setter injection is sometimes annoyingand while developing, it may eat a lot of time. Also it is simpler to not bother with explicit injection as long as it is not needed (e.g. in small application, not public project etc.)., (*2)

Requirements

  • PHP 5.3.1 or newer
  • Nette 2.1 or newer

Installation

  1. Add "majkl578/nette-injects-extension" to your dependencies in composer.json. Don't forget to run composer update.
  2. Register this DI extension as last one in your configuration file in extensions section, (*3)

    injects: Majkl578\NetteAddons\Injects\DI\Extension\InjectsExtension
    
  3. Delete cache., (*4)

You're done. ;), (*5)

Usage

All types of instance properties are supported - public, protected as well as private. You can also inject a set of classes of a type, e.g. all implementers of an interface. Also works well with namespaced code and uses., (*6)

class Foo
{
    /**
     * @inject
     * @var Foo
     */
    public $foo;

    /**
     * @inject
     * @var Bar
     */
    protected $bar;

    /**
     * @inject
     * @var Baz
     */
    private $baz;

    /**
     * @inject
     * @var IWatcher[]
     */
     protected $watchers;
}

Issues

In case of any problems, just leave an issue here on GitHub (or, better, send a pull request)., (*7)

The Versions

12/12 2013

dev-master

9999999-dev

Nette Framework DI extension for injecting services into other services' properties.

  Sources   Download

MIT

The Requires

 

by Michael Moravec

dependency injection nette di inject autowire

12/12 2013

v0.1.0

0.1.0.0

Nette Framework DI extension for injecting services into other services' properties.

  Sources   Download

MIT

The Requires

 

by Michael Moravec

dependency injection nette di inject autowire