Skip to content

laravel-bridge/container

Repository files navigation

Container Bridge

Build Status codecov Codacy Badge Latest Stable Version Total Downloads License

The PSR-11 container bridges.

Pimple container interface bridge to others

Build the wrapper.

// Laravel Container
$actualContainer = new \Illuminate\Container\Container();
$actualContainer->instance('foo', 'foo');

$wrapper = new \LaravelBridge\Container\Pimple\ContainerWrapper();
$wrapper->setContainer($actualContainer);

// Use like the Pimple Container, but it will register on Laravel Container
$wrapper['bar'] = function($c) {
    return 'bar' . $c->get('foo');
};

$wrapper->get('bar'); // 'barfoo'
$actualContainer->make('bar'); // 'barfoo'

Use ServiceProvider bridge

// Laravel Container
$actualContainer = new \Illuminate\Container\Container();

$bridge = new \LaravelBridge\Container\Pimple\ServiceProviderBridge($actualContainer);

$bridge->register(new YourPimpleServiceProvider());

License

The MIT License (MIT). Please see License File for more information.

About

The PSR-11 container bridges

Resources

License

Stars

Watchers

Forks

Packages

No packages published