Thanks to visit codestin.com
Credit goes to github.com

Skip to content

dugajean/pouch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pouch

Build Status Latest Stable Version Total Downloads License

Tiny IoC Container with automatic resolution for your PHP project.

Requirements

Install

Via Composer

$ 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

use Pouch\Pouch;

Pouch::bootstrap(__DIR__);

// ...

pouch()->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

namespace Foo;

class Bar
{
    public function doSomething(Baz $baz)
    {
        $baz->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()->resolve($key).

Read the wiki and the API docs for further information.

Testing

$ vendor/bin/phpunit

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

Pouch is released under the MIT License.

Support on Beerpay

Hey dude! Help me out for a couple of 🍻!

Beerpay Beerpay

About

Tiny IoC container with awesome autowiring & more - for your PHP project.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages