PHP Classes

File: example.php

Recommend this page to a friend!
  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: Update of example.php
Date: 2 months 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);
?>