PHP code example of dakujem / sleeve

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

    

dakujem / sleeve example snippets


$dic = new Dakujem\Sleeve;

// the following are equivalent
$service = $dic->get('service');    // getter
$service = $dic['service'];         // array accessor
$service = $dic->service;           // magic accessor

// it works for setting services as well
$factory = function(Container $dic) {
               return new Acme\MyService($dic->get('dependency'));
           };
$dic->set('service', $factory);     // setter
$dic['service'] = $factory;         // array accessor
$dic->service = $factory;           // magic accessor