1. Go to this page and download the library: Download seeren/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/ */
seeren / container example snippets
use Seeren\Container\Container;
$container = new Container();
$foo = $container->get('Dummy\Foo');
namespace Dummy;
class Foo
{
public function __construct(Bar $bar){}
}
class Bar
{
public function __construct(Baz $baz){}
}
class Baz {}
namespace Dummy;
class Foo {
public function __construct(BarInterface $bar){}
}
namespace Dummy;
class Foo
{
public function __construct(string $bar){}
}
namespace Dummy;
class Foo
{
public function __construct(BarInterface $bar){}
public function action(int $id, Baz $baz)
{
return 'Hello';
}
}
use Seeren\Container\Container;
$container = new Container();
$message = $container->call('Dummy\Foo', 'action', [7]);
echo $message; // Hello
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.