PHP code example of opensourcerefinery / yaml2pimple
1. Go to this page and download the library: Download opensourcerefinery/yaml2pimple 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/ */
opensourcerefinery / yaml2pimple example snippets
use Pimple\Container;
$container = new Container();
$container['name'] = 'Gonzalo';
$container['Curl'] = function () {
return new Curl();
};
$container['Proxy'] = function ($c) {
return new Proxy($c['Curl']);
};
$container['App'] = function ($c) {
return new App($c['Proxy'], $c['name']);
};
$app = $container['App'];
echo $app->hello();
use Pimple\Container;
use OpenSourceRefinery\Yaml2Pimple\ContainerBuilder;
use OpenSourceRefinery\Yaml2Pimple\YamlFileLoader;
use Symfony\Component\Config\FileLocator;
$container = new Container();
$builder = new ContainerBuilder($container);
$locator = new FileLocator(__DIR__);
$loader = new YamlFileLoader($builder, $locator);
$loader->load('services.yml');
$app = $container['App'];
echo $app->hello();