PHP code example of ghosty / container

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

    

ghosty / container example snippets


use Ghosty\Container\Container;

Container::getInstance()->bind(TestContract::class, Test::class);


use Ghosty\Container\Container;

Container::getInstance()->singleton(TestContract::class, Test::class);

use Ghosty\Container\Container;

Container::getInstance()->bind(TestContract::class, Test::class, true);

use Ghosty\Container\Container;

Container::getInstance()->make(TestContract::class);

use Ghosty\Container\Container;

Container::getInstance()->has(TestContract::class);

use Ghosty\Container\Facades\Container;

Container::bind(TestContract::class, Test::class);


use Ghosty\Container\Facades\Container;

Container::make(TestContract::class);