PHP code example of sherv / wp-di-container

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

    

sherv / wp-di-container example snippets


use Sherv\Container\Container;

$container = new Container();

// Bind an interface to a concrete implementation.
$container->bind( Logger_Contract::class, File_Logger::class );

// Resolve. File_Logger and all its dependencies are built automatically.
$logger = $container->make( Logger_Contract::class );