frozzare/tank

WordPress Container

v1.3.1 2017-02-21 10:42 UTC

This package is auto-updated.

Last update: 2022-07-29 01:40:39 UTC


README

Build Status codecov.io License No Maintenance Intended

Requires PHP 5.6

WordPress Container.

Install

composer require frozzare/tank

Container example

use Frozzare\Tank\Container;

class Plugin_Loader extends Container {

  public function __construct() {
    $this->bind( 'number', 12345 );
  }

}

$loader = new Plugin_Loader;

echo $loader->make( 'number' );
// 12345

Check the container source code for methods that can be used.

Service provider example

use Frozzare\Tank\Container;
use Frozzare\Tank\Service_Provider;

class Example_Provider extends Service_Provider {

  public function register() {
    $this->container->bind( 'say', 'Hello!' );
  }

}

$container = new Container;
$provider  = new Example_Provider( $container );
$provider->register();

echo $container->make( 'say' );
// Hello!

License

MIT © Fredrik Forsmo