https://github.com/wpup/tank
:ship: WordPress Container
https://github.com/wpup/tank
Last synced: 9 months ago
JSON representation
:ship: WordPress Container
- Host: GitHub
- URL: https://github.com/wpup/tank
- Owner: wpup
- License: mit
- Created: 2015-08-05T14:49:03.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2019-12-02T14:21:37.000Z (over 6 years ago)
- Last Synced: 2024-12-15T05:37:42.059Z (over 1 year ago)
- Language: PHP
- Homepage:
- Size: 1.39 MB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tank
[](https://travis-ci.org/wpup/tank) [](http://codecov.io/github/wpup/tank?branch=master)
[](https://packagist.org/packages/frozzare/tank)
[](http://unmaintained.tech/)
> Requires PHP 5.6
WordPress Container.
## Install
```
composer require frozzare/tank
```
## Container example
```php
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](https://github.com/wpup/tank/blob/master/src/class-container.php) for methods that can be used.
## Service provider example
```php
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](https://github.com/frozzare)