PHP code example of miniature / di_container

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

    

miniature / di_container example snippets




function miniature_autoload($class)
{
    $fileName = str_replace('\\', '/', realpath(__DIR__) . '/' . $class ) . '.php';
    if (preg_match('/^(.*\/Miniature)\/(\w+)\/((\w+\/)*)(\w+)\.php/', $fileName)) {
        $newFileName = preg_replace(
            '/^(.*\/Miniature)\/(\w+)\/((\w+\/)*)(\w+)\.php/',
            '$1/$2/src/$3$5.php',
            $fileName
        );
        if (is_file($newFileName)) {
            

$myDiContainer = (new \Miniature\DiContainer\DiContainer())
    ->readMappings($configArray);

$myDiContainer = (
    new \Miniature\DiContainer\DiContainer(
            new \Miniature\DiContainer\Syntax\MapperSymfonyStyle()
        )
    )->readMappings($configArray);