Skip to content

heera/Auryn

This branch is 265 commits behind rdlowrey/auryn:master.

Folders and files

NameName
Last commit message
Last commit date
Sep 24, 2013
Sep 24, 2013
Aug 22, 2013
Jun 27, 2013
Sep 9, 2013
Oct 1, 2012
Oct 2, 2012
Jul 8, 2013

Repository files navigation

Auryn

Auryn is a PHP dependency injection container (DIC). Use Auryn to bootstrap and wire together S.O.L.I.D., object-oriented PHP applications. For help and usage examples, check out the Auryn Wiki.

EXAMPLE

<?php
class MyUniversalConfig {
    public $configVar = 'default config value';
}
class Dependency {}
class AnotherDependency {}
class Example {
    private $config;
    private $dep;
    function __construct(MyUniversalConfig $config, Dependency $dep){
        $this->config = $config;
        $this->dep = $dep;
    }
    function myMethod(AnotherDependency $anotherDep, $arg) {
        return "Config: {$this->config->configVar} | Scalar arg: {$arg}";
    }
}

$config = new MyUniversalConfig;
$injector = new Auryn\Provider;
$injector->share($config);
$config->configVar = 'altered value';

// outputs: "Config: altered value | Scalar arg: 42"
echo $injector->execute('Example::myMethod', $args = [':arg' => 42]);

REQUIREMENTS

  • PHP 5.3+

INSTALL

Git:
$ git clone git://github.com/rdlowrey/Auryn.git
Manual Download:

Tagged Releases page.

Composer:
$ composer.phar rdlowrey/auryn

AUTOLOADING

If you aren't using composer to manage dependencies, Auryn ships with an autoloader to simplify usage of the included libraries. Simply include the autoloader script to get started:

<?php
require '/hard/path/to/auryn/autoload.php';

Auryn uses a PSR-0-compatible directory structure, so you can alternatively follow the usual PSR-0 loading practices:

<?php
$loader = new SplClassLoader('Auryn', '/hard/path/to/auryn/src');
$loader->register();

About

PHP Dependency Injection Container

Resources

License

Stars

Watchers

Forks

Packages

No packages published