PHP Analytics



Find the latest version of PhpAnalitics on our repository.

This command line check out the library only :

svn co

Saiku Installation

PHP Analytics doesn’t take care of processing the queries itself. This is done by Saiku, an Open Source server, and here is how to install it:

  1. Download the “Saiku Server Foodmart” package corresponding to your Operating System on Analytical-Labs website;
  2. Unpack the archive in the folder where you want to install the server;
  3. Add the JDBC driver for your database in the tomcat/webapps/saiku/WEB-INF/lib/ folder.
  4. Execute or start-saiku.bat (depending on your OS) located in the Saiku folder;
  5. You’re done !

Now, you can test your Saiku installation by browsing http://localhost:8080.

Configure your own cube

Saiku comes with the FoodMart database, which is great for testing purposes.
However, this is not the database you want to work with. Let’s create a cube based on your own database :

  1. Create a schema file which will configure the cube on the relational database. You may read the schema tutorial or download the schema workbench (workbench documentation) ; copy this file at [PHP Analytics installation folder]/data/catalog;
  2. Go into the following folder: [Saiku-Directory]/tomcat/webapps/saiku/WEB-INF/classes/saiku-datasources;
  3. Create a new connection based on the README file instructions (for the catalog location, this is [PHP Analytics installation folder]/data/catalog/[filename]);
  4. Restart Saiku.
  5. You’re done !

Installation inside a Zend Application

Let’s see how to install PHP Analytics in a Zend Framework application:

  1. Download PHP Analytics last release in Downloads section.
  2. Copy “PhpAnalytics” folder into your library folder.
  3. Add “PhpAnalytics_” to the autoloader with this configuration line to your application.ini:

    autoloadernamespaces.PhpAnalytics = "PhpAnalytics_"

  4. Copy the javascript API file into your public folder. Make sure it is included in pages that will display a cube.
  5. Optional: If you want to use a useful action helper, add “PhpAnalytics_Controller_Action_Helper” prefix to the helper broker.
  6. Create your configuration file for saiku connection (see the configuration tutorial)
  7. You’re done !

Demo install

A few step will allow you to run the zend demo:

  1. Checkout the demo code, it embed his own Zend lib (minimal) and PhpAnalytics version using svn externals. Please be patient as Zend minimal is quite large.
  2. Create the demo database on your favorite DBMS and fill it with the provided script : demo/data/create_and_populate_demo_database.sql
  3. Configure Saiku as detailed in the Saiku installation section. Our Saiku config file might help: demo/data/saiku_config_example
  4. Don’t forget to configure your web server. His root directory should lead to the demo “public” directory.
  5. Configure the demo app using the standard config scripts (demo/application/configs/*.ini)
  6. You’re done !