Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 22 days 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 8 years ago)
- Default Branch: master
- Last Pushed: 2019-08-20T07:12:17.000Z (over 5 years ago)
- Last Synced: 2024-08-08T20:39:48.793Z (5 months 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: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Pouch
[![Build Status](https://travis-ci.org/dugajean/pouch.svg?branch=master)](https://travis-ci.org/dugajean/pouch)
[![Latest Stable Version](https://poser.pugx.org/dugajean/pouch/v/stable)](https://packagist.org/packages/dugajean/pouch)
[![Total Downloads](https://poser.pugx.org/dugajean/pouch/downloads)](https://packagist.org/packages/dugajean/pouch)
[![License](https://poser.pugx.org/dugajean/pouch/license)](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).