2017 © Pedro Peláez
 

library yaml2pimple

Build a Pimple/Container from a config file

image

opensourcerefinery/yaml2pimple

Build a Pimple/Container from a config file

  • Monday, May 8, 2017
  • by mkoert
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,513 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 11 Forks
  • 0 Open issues
  • 7 Versions
  • 22 % Grown

The README.md

Pimple/Container builder

Build Status, (*1)

Simple tool build pimple containers from a configuration file, (*2)

Imagine this simple application:, (*3)

use Pimple\Container;

$container         = new Container();
$container['name'] = 'Gonzalo';

$container['Curl']  = function () {
    return new Curl();
};
$container['Proxy'] = function ($c) {
    return new Proxy($c['Curl']);
};

$container['App'] = function ($c) {
    return new App($c['Proxy'], $c['name']);
};

$app = $container['App'];
echo $app->hello();

We define the dependencies with code. But we want to define dependencies using a yml file for example:, (*4)

parameters:
  name: Gonzalo

services:
  App:
    class:     App
    arguments: [@Proxy, %name%]
  Proxy:
    class:     Proxy
    arguments: [@Curl]
  Curl:
    class:     Curl

With this library we can create a pimple container from this yaml file (similar syntax than Symfony's Dependency Injection Container), (*5)

use Pimple\Container;
use OpenSourceRefinery\Yaml2Pimple\ContainerBuilder;
use OpenSourceRefinery\Yaml2Pimple\YamlFileLoader;
use Symfony\Component\Config\FileLocator;

$container = new Container();

$builder = new ContainerBuilder($container);
$locator = new FileLocator(__DIR__);
$loader = new YamlFileLoader($builder, $locator);
$loader->load('services.yml');

$app = $container['App'];
echo $app->hello();

License

Yaml2Pimple is licensed under the MIT license., (*6)

Change Log

1.1.0

  • We have a license. Pulled from the original - https://github.com/gonzalo123/yml2pimple/blob/master/LICENSE

1.0.0

  • Just because its needed

0.1.1 Forked from opensourcerefinery/yml2pimple

Added the pimple container as the last argument, (*7)

0.1.0 Forked from opensourcerefinery/yml2pimple

Creating a release to have a stable version., (*8)

The Versions

08/05 2017

dev-develop

dev-develop

Build a Pimple/Container from a config file

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Koert

dependency injection container pimple

08/05 2017

dev-master

9999999-dev

Build a Pimple/Container from a config file

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Koert

dependency injection container pimple

08/05 2017

2.0.0

2.0.0.0

Build a Pimple/Container from a config file

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Koert

dependency injection container pimple

30/03 2017

1.1.0

1.1.0.0

Build a Pimple/Container from a config file

  Sources   Download

MIT

The Requires

 

by Michael Koert

dependency injection container pimple

15/12 2016

1.0.0

1.0.0.0

Build a Pimple/Container from a config file

  Sources   Download

MIT

The Requires

 

dependency injection container pimple

24/04 2015

0.1.1

0.1.1.0

Build a Pimple/Container from a config file

  Sources   Download

MIT

The Requires

 

dependency injection container pimple

19/03 2015

0.1.0

0.1.0.0

Build a Pimple/Container from a config file

  Sources   Download

MIT

The Requires

 

dependency injection container pimple