Deprecated: Assigning the return value of new by reference is deprecated in /storage/content/94/122194/ on line 1098 Deprecated: Assigning the return value of new by reference is deprecated in /storage/content/94/122194/ on line 132 Deprecated: Assigning the return value of new by reference is deprecated in /storage/content/94/122194/ on line 215 PHP Example Application - OneCMDB

PHP Example Application

From OneCMDB


PHP Example Application

The PHP example application shows CI in tables defined by the user. The columns in the table is configurable, and editable. It's all written in PHP and uses the WebService interface introduced in OneCMDB 1.3.0. The code can be downloaded from SourceForge.

For more documentation on Web Service API and OneCMDB see Web Services and Tutorial.


  • PHP version 5 with SOAP enabled.
  • A http server, like apache, that is configured for php.
  • OneCMDB 1.3.0 installed.


  • Unpack the tar file so the http server can access it.
  • Specify where onecmdb is installed, if not on localhost.
    • Edit the file onecmdb-tool.php, function getOneCMDB_URL().


  • Go to page http://localhost/onecmdb-php-example/login.php, or where the http server is installed.
  • Login with user=admin, pwd=123.
  • Configure the tables by clicking on the Table View Configuration.
  • Once the table are configured it will be listed on the main page.

Configuring Table Views

To add a new table, press [add] and then press [edit] to edit.

Four fields needs to be filled in to configured a table.

  • Image
    • URL to an image to be displayed with the title.
  • Title
    • Title of the table, will be displayed on the main page.
  • Template
    • All instances of this template alias will be showed in the table.
  • Columns
    • An expression specifying the columns to be displayed, see below.

Columns Field

The columns field has the following syntax



ColHeaderN is what will be displayed at the column header.

ExprN is evaluated for every row (instance). The expression can be either an attribute in the CI or it could be the another CI is referring to the instance CI.


For basic understanding of CI and attributes check the Web Services and Tutorial documentation for more info.

  • Simple Attributes
    • ${alias} the alias of the CI.
    • ${displayName} the displayName of the CI.
    • ${attrAlias} the value of the attribute alias.
  • Complex Attributes(References)
    • $>attr{attrAlias}|>attr{attrAlias2}
      • Will show the reference CI following the path attrAlias.attrAlias2. The | sign is regarded as a delimiter.
    • <$template{templateAlias}
      • Will show all CI that references this CI.
  • NOTE: The >attr{alias} and <template{alias} can be combined on the same expression.


To list all Hardware instances with displayName,Name,Type and softwares enter the following

template: Hardware
columns: [ID,${displayName}];[Name,${A_Name}];[Type,${A_Type}];[Software,${K_Software}]

To list all Software and on which hardware it runs on enter the following:

template: Software
columns: [ID,${displayName}];[Name,${A_Name}];[Hardware,$<template{Hardware}]
Community and support