PHP code example of matecat / simple-dic

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

    

matecat / simple-dic example snippets


DIC::setCacheDir(__DIR__.'/../_cache_custom');
DIC::initFromFile(__DIR__ . '/../config/ini/redis.ini');

// ...

use Matecat\SimpleDIC\DICParams;

DICParams::initFromFile('your_params_file.yaml');

use Matecat\SimpleDIC\DIC;

$dependency = DIC::get('key');

#!/usr/bin/env php

set_time_limit(0);

...

use Symfony\Component\Yaml\Yaml;

// create symfony console app
$app = new \Symfony\Component\Console\Application('Simple DIC', 'console tool');

// config
$configFile = __DIR__.'/../config/yaml/config.yaml';

// add commands here
$app->add(new \Matecat\SimpleDIC\Console\DICDebug($configFile));
$app->run();