Coder Social home page Coder Social logo

auryn's Introduction

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

auryn's People

Contributors

ascii-soup avatar morrisonlevi avatar rdlowrey avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.