Getting Started



The builder() method starts the report building process. Methods can subsequently be called on the returned object to set the connection to the datasource, provide the query and any further options such as criteria, grouping, expressions, styling etc.

Before writing queries using the Reportico as a framework library you need to ensure it is included and available for use in your code. When using Reportico as a standalone module you need to include the Reportico composer package with command :-

require_once('/vendor/autoload.php');

Then wherever in your code you need to include a Reportico report menu, a report criteria selection screen or just report output, begin the query with

\Reportico\Engine\Builder::build()

Then you chain further methods on to include the database selection and create the report definition.

\Reportico\Engine\Builder::build()
    ->datasource()->database("mysql:host=localhost; dbname=DATABASE NAME")->user("USER")->password("PASSWORD")
    ->sql("SELECT column1 FROM table1")
    ...

Then you must finish the report with one of the following methods :-
  • execute() - Runs the report and sends the output to the desired output format (defaults to HTML in the browser)
  • prepare() - Presents you with a selection screen to choose report criteria and output format
  • menu() - Presents menu of reports you have already written under a project. Only works where you have used the designer to create a project

If you do not specify any of these options no output will appear.

\Reportico\Engine\Builder::build()
    ->datasource()->database("mysql:host=localhost; dbname=DATABASE NAME")->user("USER")->password("PASSWORD")
    ->sql("SELECT column1 FROM table1")
    ->execute();