Download the PHP package benwilkins/laravel-analyst without Composer

On this page you can find all versions of the php package benwilkins/laravel-analyst. 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 laravel-analyst

Laravel Analyst

Latest Version

Use this package to retrieve analytics about your app, from one or many data sources. Currently, this package supports an internal data source and Google Analytics.

Install

This package can be installed through Composer.

Once installed, add the service provider:

Publish the config file:

This package also comes with a facade, making it easy to call the class:

The following config file will be published in config/laravel-analyst.php

Internal Client

The internal client can be used to pull analytics from within your app's databse. By default, the client comes with one metric: NewUsersMetric.

Custom Metrics

Custom metrics for the internal client can be used by creating a Metric class and adding it to the custom metric directory. By default, that directory is /app/Metrics/, but can be changed from the config.

To add a custom metric:

  1. Create a new class with the namespace Benwilkins\Analyst\Clients\Internal\Metrics. The class should extend the Metric abstract class.
  2. Your class must implement the run method. This method takes two arguments: $period and $params. The period is an instance of the Period class that defines the date range for the metric. The params argument allows custom parameters to be applied to the metric, such as filters.

Example Usage

To use the Internal client, follow this example:

Google Analytics Client

The Google Analytics Client uses the Analytics Reporting API. You'll need to get a Google Service Account Key from the Google Developers Console:

  1. In the console, follow the steps to create a new app.
  2. Enable the Analytics Reporting API
  3. Click on the Credentials tab, and follow the steps to create credentials.
  4. Select Service Account Key as the credential type.
  5. Select a New Service Account and give it a name. Choose JSON as the Key Type.
  6. Download the JSON file and save it in the location specified in the package config file.

Finally, you'll need to grant permissions to your Google Analytics property:

  1. Go to "User Management" in the admin section of the property.
  2. Use the email address found in the client_email key from the JSON file you downloaded. Read only access is sufficient.

Options

The Google Analytics client offers some options for configuration:

Example

This example queries for events, accepting the ga:eventCategory, ga:eventAction, ga:eventLabel, and ga:date dimensions. The results are grouped by a combination of ga:eventCategory and ga:eventAction.

The value of $metric will be an instance of AnalystDataCollection.

Accessing your data

Analyst Data Collections

Both clients return an instance of AnalystDataCollection. This collection has some accessor methods making it easy to use your data:

Analyst Data Groups

The AnalystDataGroup class is a grouping of your data. Each metric call will have a minimum of one group. A group consists of two main properties: total, and points.

Roadmap

Security

If you discover any security related issues, please use the issue tracker on GitHub.

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-analyst with dependencies

PHP Build Version
Package Version
Requires google/apiclient Version ^2.1
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 benwilkins/laravel-analyst contains the following files

Loading the files please wait ....