Skip to content
/ tank Public
forked from wpup/tank

🚢 WordPress Container

License

Notifications You must be signed in to change notification settings

stfturist/tank

 
 

Repository files navigation

tank

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

Packages

No packages published

Languages

  • PHP 100.0%