PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Mark Rolich  >  IoC  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: IoC
Resolve class dependencies from configuration
Author: By
Last change:
Date: 2 years ago
Size: 438 bytes
 

Contents

Class file image Download
<?php
define
('DS', DIRECTORY_SEPARATOR);
define('BASEDIR', __DIR__ . DS);
define('LIBDIR', BASEDIR . DS . 'lib' . DS);

$config = array(
   
'test' => 1
);

include
BASEDIR . 'iocconfig.php';
include
LIBDIR . 'Autoloader.php';

Autoloader::register();

$ioc = new IOC($iocconfig);

$superUser = $ioc->resolve('SuperUser');
$newSuperUser = $ioc->resolve('SuperUser');
$user = $ioc->resolve('User');

echo
$user->get(1);
?>