Login   Register  
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 David Palmer  >  phpBoing  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: a brief example of usage
Class: phpBoing
Inject dependency objects from XML definitions
Author: By
Last change:
Date: 5 years ago
Size: 990 bytes
 

Contents

Class file image Download
<?php
/*
 * This is an example to illustrate how to use PHP Boing. Please
 * note that this is a very simple example. For a more sophisticated
 * example, look into 'ref_app' (reference application) - which is a
 * full blown MVC web application framework, that uses phpBoing. 
 * 
 * author: David Palmer <blinder.dave@gmail.com>
 */
include_once("config.php"); // defines our core constants we need
include_once("c_container.php"); // phpBoing itself
include_once("c_tools.php"); // separate tool/utility functions

// lets make sure our dependent class definitions are loaded
Tools::loadClassPath(CLASSPATH);

// lets initialize our cache system
$memcache Tools::initCache();

$container=null;
try {
    
$container = new Container(); // instantiate our container class
} catch (Exception $ex) {
    
// do something with exception
}
// now lets call our simple example bean:
$smipleExample $container->getBean("simpleExample");
$simpleExample->printMessage();
?>