frozzare / tank
WordPress Container
Installs: 7 038
Dependents: 7
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: ^5.6 || ^7.0
- composer/installers: ~1.0
Requires (Dev)
- phpunit/phpunit: ~5.0
- wp-coding-standards/wpcs: ~0.10
README
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