2017 © Pedro Peláez
 

library registrar

Registrar component

image

gobline/registrar

Registrar component

  • Wednesday, February 1, 2017
  • by mdecaffmeyer
  • Repository
  • 1 Watchers
  • 1 Stars
  • 64 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 2 % Grown

The README.md

Registrar component

The Registrar component takes a Gobline container and allows you to add services to it defined in one or more configuration files. It loads the right configuration files based on the current environment (dev, prod, ...)., (*1)

$container = new Gobline\Container();

$registrar = new Gobline\Registrar\Registrar($container, 'dev');
$registrar->register(getcwd().'/config/services.php');

In the above code, we set the environment to "dev", and the Registrar will attempt to add the services defined in the following files to the container: * services.php (if exists) * services.dev.php (if exists), (*2)

The services listed in the configuration file are defined in a PHP array, which its structure follows a convention. Below is an example of a configuration file:, (*3)

return [
    Pdo::class => [
        'construct' => [
            'arguments' => ['sqlite:db.sqlite'],
        ],
    ],
    Swift_SmtpTransport::class => [
        'alias' => Swift_Transport::class,
        'construct' => [
            'arguments' => ['smtp.gmail.com', 465, 'ssl'],
        ],
        'configure' => [
            'data' => [
                'username' => 'mdecaffmeyer@gmail.com',
                'password' => '***',
            ],
        ],
    ],
    Gobline\Auth\Authenticator\Db\DbAuthenticator::class => [
        'alias' => Gobline\Auth\Authenticator\AuthenticatorInterface::class,
    ],
    Gobline\Auth\CurrentUser::class => [
        'alias' => Gobline\Auth\CurrentUserInterface::class,
        'configure' => [
            'configurator' => Gobline\Auth\Provider\Gobline\CurrentUserConfigurator::class,
            'data' => [
                'persistence' => 'session',
                'roleUnauthenticated' => 'unauthenticated',
            ],
        ],
    ],
    Doctrine\ORM\EntityManager::class => [
        'construct' => [
            'factory' => App\Provider\EntityManagerFactory::class,
        ],
    ],

];

The Versions

01/02 2017

dev-master

9999999-dev https://github.com/gobline

Registrar component

  Sources   Download

BSD-3-Clause

The Requires

 

by Mathieu Decaffmeyer

dependency injection registrar gobline

07/12 2015

v1.0.2

1.0.2.0 https://github.com/gobline

Registrar component

  Sources   Download

BSD-3-Clause

The Requires

 

by Mathieu Decaffmeyer

dependency injection registrar gobline

03/12 2015

v1.0.1

1.0.1.0 https://github.com/gobline

Registrar component

  Sources   Download

BSD-3-Clause

The Requires

 

by Mathieu Decaffmeyer

dependency injection registrar gobline

03/12 2015

v1.0.0

1.0.0.0 https://github.com/gobline

Registrar component

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.6.0

 

by Mathieu Decaffmeyer

dependency injection registrar gobline

27/08 2015

v0.9.0

0.9.0.0 https://github.com/mendoframework

Mendo Registrar Component

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Mathieu Decaffmeyer

dependency injection registrar mf mendoframework mendo framework