2017 © Pedro Peláez
 

library dic

DIC (Dependency Injection Container) Libraries for Kecik Framework

image

kecik/dic

DIC (Dependency Injection Container) Libraries for Kecik Framework

  • Friday, April 17, 2015
  • by dnaextrim
  • Repository
  • 1 Watchers
  • 2 Stars
  • 143 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Kecik DIC (Dependency Injection Container)

This library is a library supporters to support the Dependency Injection Container problems, so the library is an object, controller, it could be a model or library will be loaded only once, so as to avoid wastage., (*1)

Installation

file composer.json, (*2)

{
    "require": {
        "kecik/dic": "dev-master"
    }
}

run a command, (*3)

composer install

Example Using

 array (
        'DIC' => array (
            'enable' => TRUE
        )
    ),
);

$app = new Kecik\Kecik($config);

class Test1 {
    public function __construct() {
        echo "Hello is Test1 
"; } } class Test2 { public function __construct(Test1 $test) { echo "Hello is Test2
"; } public function index() { echo 'Is Index'; } } $app->container['Test1'] = function($c) { return new Test1(); }; $app->container['Test2'] = function($c) { return new Test2($c['Test1']); }; $app->container['Test3'] = $app->container->factory(function($c) { return new Test2($c['Test1']); }); $app->get('/', function() use ($app){ $app->container['Test1']; $app->container['Test2']->index(); }); $app->run(); ?>

or for Controller, (*4)

WelcomeController, (*5)

file: welcome.php, (*6)

 **HelloController**
> 
> file: **hello.php**

```php
 **Index**
> 
> file: **index.php**

```php
 array (
        'DIC' => array (
            'enable' => TRUE
        )
    ),
);

$app = new Kecik\Kecik($config);

$app->container['WelcomeController'] = function($c) {
    return new Controller\Welcome();
};

$app->container['HelloController'] = function($c) {
    return new Controller\Hello($c['WelcomeController']);
};

$app->get('/', function() use ($app){
    $app->container['WelcomeController'];
});

$app->get('hell/:name', function($name) use ($app) {
    $app->container['HelloController']->say($name);
});
$app->run();
?>

The Versions

17/04 2015

dev-master

9999999-dev

DIC (Dependency Injection Container) Libraries for Kecik Framework

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Dony Wahyu Isp

framework dic di kecik

17/04 2015

1.0.3

1.0.3.0

DIC (Dependency Injection Container) Libraries for Kecik Framework

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Dony Wahyu Isp

framework dic di kecik

07/04 2015

1.0.1-beta

1.0.1.0-beta

DIC (Dependency Injection Container) Class untuk Kecik Framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Dony Wahyu Isp

framework dic di kecik