HomeBack home

Show list of registered applications


 Table of contents


The getApplicationsRegistered function allows to know what is the list of applications already defined.

Of course you can anytime, remove a previous application (see unregisterApplication). But take care, that in such case, you'll lose all registered services and configuration data (all layers: 'user', 'system', 'default').



$registry = &Registry::singleton();

$registry->registerApplication('app1', 'My first application');
$registry->registerApplication('appN', 'My last application');

$apps = $registry->getApplicationsRegistered();






array(2) {
  array(2) {
    string(4) "app1"
    string(20) "My first application"
  array(2) {
    string(4) "appN"
    string(19) "My last application"


  Play example

 * Example A2 for Config_Registry : List of registered applications
 * @version    0.1
 * @author     Laurent Laville <pear@laurent-laville.org>
 * @access     public
 * @package    Config_Registry
 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
 * $Id$
require_once 'Config/Registry.php';
require_once '../handleError.php';

print "<h1>List of registered Applications </h1>";

$registry =& Config_Registry::singleton();

print "<h2>try 1</h2>";
print "<p>Given a null array if none application registered</p>";

$reg = $registry->getApplicationsRegistered();

if (count($reg) == 0) {
    echo '<font color="red"><b>None application registered yet</b></font>';

print "<h2>try 2</h2>";
print "<p>After at least one application has registered</p>";

$app = 'sw4p';
$reg = $registry->registerApplication($app, 'Setup Wizard for PHP', realpath('.'));

$reg = $registry->getApplicationsRegistered();

print "<pre>";
print "</pre>";

href:  examples/applications/getRegistered.php
Run this script