Integrate the report into a PHP application

You created a data source and at least one report design document. You can now add the necessary code to launch the report from a PHP application.

  1. If your data source needs to connect to a database, you need to establish the database connection.
  2. Configure the report.

    In this example, the report is configured to be output to PDF.

    // Configure the report
    $greRunnerObj = new FourjsReportRuntime($reportDesignFileName,"OrderReport\OrderReport");
    $greRunnerObj->configureDistributedProcessing("127.0.0.1",7000);
    $greRunnerObj->selectDevice('PDF');
    $greRunnerObj->selectPreview(false);
    $greRunnerObj->setOutputFileName($reportFileName);
  3. Instantiate the data source object from the data source library.
    // Run the report
    $reportData = new OrderReport\OrderReport($connection);
  4. Pass the object to the report engine for processing.
    $greRunnerObj->run($reportData->getMasterRecord());