PHPackages                             bolstad/analytrix - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. bolstad/analytrix

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

bolstad/analytrix
=================

jump start kit for Google Analytics-based web apps

0.4.2(10y ago)013[1 issues](https://github.com/bolstad/analytrix/issues)MITPHPPHP &gt;=5.3.0

Since Jun 7Pushed 10y ago1 watchersCompare

[ Source](https://github.com/bolstad/analytrix)[ Packagist](https://packagist.org/packages/bolstad/analytrix)[ RSS](/packages/bolstad-analytrix/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (3)Versions (15)Used By (0)

Analytrix
---------

[](#analytrix)

A PHP jump start kit for Google Analytics-based web apps. Setup your GA-API settings in your enviroments ettings (or a .env file) and you a are ready to go.

Rest on the shoulder of the gigants: **timgws/google-analytics-api** and **vlucas/phpdotenv**

Code Example
------------

[](#code-example)

```
date_default_timezone_set( 'Europe/Stockholm' );
session_start();

include 'vendor/autoload.php';

$ding = new Analytrix\Basic(  new \Dotenv\Dotenv(__DIR__), new \timgws\GoogleAnalytics\API, new Analytrix\SessionStorageFile);

$ding->storage->setBucket('bucket name');
$ACCOUNT_ID = 'ga:123456-1';
echo "ACCOUNT_ID: $ACCOUNT_ID\n";

$ding->LoginText = 'Please login here';
$ding->DieOnNoSession = true;

$ding->run();

$auth = $ding->storage->get('auth');

if ( $auth = $ding->storage->get('auth') ) {

    echo "Yes, session is set\n";

    print_r( $auth );

    $accessToken = $auth['access_token'];
    $tokenExpires = $auth['expires_in'];

    $ding->ga->setAccessToken( $accessToken );
    $ding->ga->setAccountId( $ACCOUNT_ID );

    // Set the default params. For example the start/end dates and max-results
    $defaults = array(
        'start-date' => date( 'Y-m-d', strtotime( '-1 month' ) ),
        'end-date' => date( 'Y-m-d' ),
    );
    $ding->ga->setDefaultQueryParams( $defaults );

    // Example1: Get visits by date
    $params = array(
        'metrics' => 'ga:visits',
        'dimensions' => 'ga:date',
    );
    $visits = $ding->ga->query( $params );

    echo '';
    print_r( $visits );
    echo '';
    die;
}
```

Installation
------------

[](#installation)

- Install this library via composer: `composer require 'bolstad/analytrix:dev-master'`
- Create a Project in the Google APIs Console:
- Enable the Analytics API under Services
- Under API Access: Create an Oauth 2.0 Client-ID
- Give a Product-Name, choose **Web Application** or **Service Account** depending on your needs
- Web Application: Set a redirect-uri in the project which points to your apps url
- Config your ENV with the aplication API vars with these names: CLIENT\_ID, CLIENT\_SECRET &amp; REDIRECT\_URI

API Reference
-------------

[](#api-reference)

Depending on the size of the project, if it is small and simple enough the reference docs can be added to the README. For medium size to larger projects it is important to at least provide a link to where the API reference docs live.

Describe and show how to run the tests with code examples.

Contributors
------------

[](#contributors)

Christian Bolstad

License
-------

[](#license)

MIT

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~39 days

Recently: every ~12 days

Total

7

Last Release

3760d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0ec058cc342db8fb862c97b2276cddd2127047ad6972140cbad9bff146a8825d?d=identicon)[bolstad](/maintainers/bolstad)

---

Top Contributors

[![bolstad](https://avatars.githubusercontent.com/u/62787?v=4)](https://github.com/bolstad "bolstad (45 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bolstad-analytrix/health.svg)

```
[![Health](https://phpackages.com/badges/bolstad-analytrix/health.svg)](https://phpackages.com/packages/bolstad-analytrix)
```

###  Alternatives

[roots/bedrock

WordPress boilerplate with Composer, easier configuration, and an improved folder structure

6.5k441.8k2](/packages/roots-bedrock)[akaunting/laravel-money

Currency formatting and conversion package for Laravel

7825.3M18](/packages/akaunting-laravel-money)[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

310107.9k1](/packages/cognesy-instructor-php)[blair2004/nexopos

The Free Modern Point Of Sale System build with Laravel, TailwindCSS and Vue.js.

1.2k2.3k](/packages/blair2004-nexopos)[lullabot/drainpipe

An automated build tool to allow projects to have a set standardized operations scripts.

41716.4k2](/packages/lullabot-drainpipe)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
