https://github.com/dugajean/pouch
Tiny IoC container with awesome autowiring & more - for your PHP project.
https://github.com/dugajean/pouch
container-interop dependency-injection ioc ioc-container php pouch psr-11
Last synced: 11 months ago
JSON representation
Tiny IoC container with awesome autowiring & more - for your PHP project.
- Host: GitHub
- URL: https://github.com/dugajean/pouch
- Owner: dugajean
- License: mit
- Created: 2016-09-29T11:35:47.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-08-20T07:12:17.000Z (almost 7 years ago)
- Last Synced: 2025-05-04T22:37:50.274Z (about 1 year ago)
- Topics: container-interop, dependency-injection, ioc, ioc-container, php, pouch, psr-11
- Language: PHP
- Homepage: http://api.pouch.dukagj.in
- Size: 391 KB
- Stars: 9
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Pouch
[](https://travis-ci.org/dugajean/pouch)
[](https://packagist.org/packages/dugajean/pouch)
[](https://packagist.org/packages/dugajean/pouch)
[](https://packagist.org/packages/dugajean/pouch)
Tiny IoC container with awesome autowiring & more - for your PHP project.
## Requirements
- PHP 7.1+
- [PSR-4 standard with Composer](https://getcomposer.org/doc/04-schema.md#psr-4)
## Install
Via Composer
```bash
$ composer require dugajean/pouch
```
## Usage
You may register your whole `src/` folder with this package in order to enable automatic resolution everywhere within the namespace
```php
registerNamespaces('Foo'); // Foo corresponds to src/
```
You may now just typehint to the objects your method requires and it will be automatically resolved for you.
```php
doSomethingElse();
}
}
class Baz
{
public function doSomethingElse()
{
echo 'From Baz!';
}
}
```
Constructor object arguments will also be automatically injected.
You can always manually bind data to the container using `pouch()->bind($key, $dataClosure)` and also resolve anything from the container using `pouch()->get($key)`.
**Read the [wiki](https://github.com/dugajean/pouch/wiki) and the [API docs](https://dugajean.github.io/pouch/) for further information.**
## Testing
```bash
$ vendor/bin/phpunit
```
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## License
Pouch is released under [the MIT License](LICENSE).