laravel-bridge / container
The PSR-11 container bridges
v1.1.0
2020-03-11 07:04 UTC
Requires
- php: >=7.1
- psr/container: ^1.0
Requires (Dev)
- illuminate/container: ^5.6 | ^6 | ^7
- laravel-bridge/scratch: @stable
- php-di/php-di: ^6.0
- phpstan/phpstan: ^0.12
- phpunit/phpunit: ^7 | ^8
- pimple/pimple: ^3.0
- psy/psysh: ^0.9.12
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-12-11 18:30:37 UTC
README
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.