hirak / kibi

(WIP)DI Container

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hirak/kibi

Auto Dependency Injection Container

Requirements

  • PHP >= 7
  • composer >= 1.2

Example

<?php
require 'vendor/autoload.php';
$container = new Hirak\Kibi\Instantiator;
$container->addTrait(Acme\Provider::class);

/** @var Acme\Dispatcher */
$dispatcher = $container->get(Acme\Dispatcher::class);
$dispatcher->run($_SERVER, $_REQUEST);
<?php
namespace Acme;

trait Provider
{
    public function now(): DateTimeImmutable
    {
        return new DateTimeImmutable;
    }
}

About

(WIP)DI Container

License:MIT License


Languages

Language:PHP 100.0%