2017 © Pedro Peláez
 

library silex-di-builder

A simple dependency injection builder to Silex

image

mrprompt/silex-di-builder

A simple dependency injection builder to Silex

  • Saturday, October 22, 2016
  • by mrprompt
  • Repository
  • 1 Watchers
  • 6 Stars
  • 394 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Silex DI Builder

Build Status Code Climate Test Coverage Issue Count SensioLabsInsight Dependency Status Codacy Badge, (*1)

A simple dependency injection builder to Silex based on YAML file config., (*2)

Install

composer require mrprompt/silex-di-builder

Usage

Simple create a di.yml - or other name, of course - file with the structure:, (*3)

services:
  alias1:
    - Full\Class\Name
    - dependency1

  alias2:
    - Full\ClassTwo\Name
    - dependency1
    - dependency2

When:, (*4)

  • alias1 - Is the alias from Silex
  • Full\Class\Name and Full\ClassTwo\Name - The class name to initialize
  • dependency1 and dependecy2 - Dependencies from the class, must be an alias previously created or anything

In your application bootstrap, register YAML Config Service Provider, with your DI file, (*5)


use DerAlex\Silex\YamlConfigServiceProvider; use SilexFriends\DI\Container as DiServiceProvider; .... $app->register(new YamlConfigServiceProvider(__DIR__ . '/../Resources/di.yml')); $app->register(new DiServiceProvider($app['config']['services'])); # $app['config']['services'] is an array with yml content, created by YamlConfigServiceProvider

Now, your services is available on $app container., (*6)

Testing

Just run phpunit without parameters, (*7)

phpunit

Happy Silex Coding :), (*8)

The Versions

22/10 2016

dev-master

9999999-dev

A simple dependency injection builder to Silex

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

04/08 2016

1.0.3

1.0.3.0

A simple dependency injection builder to Silex

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

04/08 2016

1.0.2

1.0.2.0

A simple dependency injection builder to Silex

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

09/03 2016

1.0.1

1.0.1.0

A simple dependency injection builder to Silex

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

17/09 2015

1.0.0

1.0.0.0

A simple depency injection container to Silex

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires