PHP code example of mouf / pimple-interop

1. Go to this page and download the library: Download mouf/pimple-interop 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/ */

    

mouf / pimple-interop example snippets


// Let's declare a first container
$pimpleParent = new PimpleInterop();
$pimpleParent['hello'] = 'world';

// Let's declare another container
// Please note the "parent" container is passed in parameter of the constructor.
$pimple = new PimpleInterop($pimpleParent);
$pimple['test']->share(function(ContainerInterop $container) {
	return "Hello ".$container->get('hello');
});

// Prints "Hello world".
echo $pimple->get('test');
// Prints "Hello world" too.
echo $pimple['test'];