Download the PHP package mothership-ec/cog-mothership-reports without Composer

On this page you can find all versions of the php package mothership-ec/cog-mothership-reports. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cog-mothership-reports

Mothership Reports

The Message\Mothership\Report cogule provides a framework for providing reports in a new tab in the control panel.

Creating a new report

Registering reports

Register your reports in the Service container of the module it's in. This is an example of code in MS-User:

Creating reports

Create a folder Reports within Src if there isn't already one. All reports for this module will be saved in here.

Initial set up

All reports must extend AbstractReport and will use:

Constructor

Set the:

Set all the filters and charts you want to use in the report.

Set any default filters you want for the report when it's first viewed.

This report displays TableChart, and uses filters DateRange and Choices. It sets the form default StartDate for 1 month ago.

getCharts()

All reports need this function:

getColumns()

Set all the columns needed into an array with the key as the name and value as type of data that's expected. This type is used for Google Charts.

_getQuery()

Using QueryBuilder create your report query. A simple example is the User Summary report:

_dataTransform()

This takes the data from the query and converts it into either a string in JSON format for use in Google Charts, or a simple array for the CSV download.

For more complicated data you might need to pass in some optional properties. See: https://developers.google.com/chart/interactive/docs/reference#cell_object

For example, to order dates in their numerical representation rather than alphabetically you will need to send the timestamp as a value but the string as formatted value.

Another example is for currency values:

For links, if you send just the html link as the value it will order the values using the full html rather than the display text. This is fine if the text is the same values used to create the URL, but in most cases the ID isn't what will be displayed. In this case, the user's name is sent as the value and the html (using the user-id) is sent as the formatted value.

Any strings which may contain special characters need encoded to UTF-8, as User does in the above example.

The full code used in the User Summary report:

Filters

DateRange

This has two datetime form fields to select a range of data between the two.

Date

This is a singular date form field to select data from one specific date.

Choices

The Choices form field can be customised depending on what data you are getting in the report.

When adding a choice form you must add the following parameters:

Charts

Table

TableChart is currently the only chart available. https://developers.google.com/chart/interactive/docs/gallery/table


All versions of cog-mothership-reports with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
mothership-ec/cog Version ~4.0
mothership-ec/cog-mothership-cp Version ~3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mothership-ec/cog-mothership-reports contains the following files

Loading the files please wait ....