PHP code example of jankal / checked-instance

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

    

jankal / checked-instance example snippets



$factory = CheckedInstance\Factory::for(TestClass::class);
$object = $factory->make();


$factory = new CheckedInstance\Factory();
$factory->as(TestClass::class);
$object = $factory->make();


$factory = new CheckedInstance\Factory();
$object = $factory->make(TestClass::class);


$factory = new CheckedInstance\Factory();
$factory->with('authKey', '84746afg7u789h2');
$object = $factory->make();


/** @var $c \Psr\Container\ContainerInterface */
CheckedInstance\Factory::container($c);
$factory = new CheckedInstance\Factory();
$object = $factory->make();


/** @var $c \Psr\Container\ContainerInterface */
CheckedInstance\Factory::container($c);
$factory = CheckedInstance\Factory::prefix('test.');
$object = $factory->make();


class TestInstance extends CheckedInstance\Instance {
    protected $