PHP code example of eserozvataf / scabbia2-services
1. Go to this page and download the library: Download eserozvataf/scabbia2-services 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/ */
eserozvataf / scabbia2-services example snippets
use Scabbia\Services;
$container = new Services();
$container['key'] = 'value';
echo $container['key'];
use Scabbia\Services;
$container = Services::getCurrent();
$container['key'] = ['sample', 'array'];
var_dump($container['key']);
use Scabbia\Services;
$container = Services::getCurrent();
$container->setFactory('key', function () {
return ['time' => microtime(true)];
});
var_dump($container['key']);
var_dump($container['key']); // will be different than previous one
use Scabbia\Services;
$container = Services::getCurrent();
$container['key'] = 'test';
$container->decorate('key', function ($value) {
return $value . 'ing';
});
$container->decorate('key', function ($value) {
return strtoupper($value);
});
var_dump($container['key']); // returns 'TESTING'
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.