PHP code example of mrjulio / rapture-container

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

    

mrjulio / rapture-container example snippets


$container = Container::instance('namespace'); // optional namespace

// store
$container['request'] = Request::fromGlobals();

// fetch
$container['request']->getUri()->getPath();

// reflection
Container::instance()['\Demo\User']; // runs reflection and caches result

// no reflection on 2nd run
Container::instance()->getNew('\Demo\User'); // get a new instance