PHP code example of laravel-bridge / container
1. Go to this page and download the library: Download laravel-bridge/container library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
laravel-bridge / container example snippets
// 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'
// Laravel Container
$actualContainer = new \Illuminate\Container\Container();
$bridge = new \LaravelBridge\Container\Pimple\ServiceProviderBridge($actualContainer);
$bridge->register(new YourPimpleServiceProvider());