2017 © Pedro Peláez
 

library laravel-statcounter

Laravel integration of the StatCounter API

image

injic/laravel-statcounter

Laravel integration of the StatCounter API

  • Wednesday, March 2, 2016
  • by jamesmirvine
  • Repository
  • 1 Watchers
  • 2 Stars
  • 103 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

StatCounter API with support for Laravel 5

Latest Stable Version License, (*1)

The package supports use with the Laravel framework (v5) providing a Stat facade for the StatCounter API. You can find the documentation for this package [here][6]., (*2)


Setup:

In order to install, add the following to your composer.json file within the require block:, (*3)

{
    "require": {
        "injic/laravel-statcounter": "2.*",
    }
}

Now, run the command composer update., (*4)

Within Laravel, locate the file /config/app.php. Add the following to the providers array:, (*5)

Injic\LaravelStatcounter\LaravelStatcounterServiceProvider::class,

Furthermore, add the following the aliases array:, (*6)

'Stat' => Injic\LaravelStatcounter\Facades\Stat::class,

Publish the configuration, (*7)

$ php artisan vendor:publish --provider="Injic\LaravelStatcounter\LaravelStatcounterServiceProvider"

Find the package's config found in /config/statcounter.php. You'll need to fill out your StatCounter username, API password, and project information. Since the config file contains further information on the individual values, here are a few things to note: - username is the case-sensitive login username for StatCounter - password referes to the API password, not the login password (see API Password) - default must match one of the project names under projects - your-project-name is the only value that isn't specified by StatCounter. It's an alias of your choosing used when calling functions which handle projects. - projects and security-codes must having matching keys (i.e. the project names)., (*8)


Usage:

Methods of the Stat class simplify what is needed for a StatCounter API query as described in the StatCounter API Documentation. Additionally, the Stat class was modeled off of the Laravel DB Query design, and you may expect similar methods., (*9)

You can find the documentation for this package [here][6]., (*10)


Examples:

// Retrieve an array of browser objects (http://api.statcounter.com/docs/v3#browsers)
$stats = Stat::browsers()->get();

// Retrieve an array of summary objects (http://api.statcounter.com/docs/v3#summary-daily)
$now = \Carbon\Carbon::now(); // http://carbon.nesbot.com/
$stats = Stat::summary()->setRange(Granularity::DAILY, $now->subWeek(), $now)->get();

// Paginate the recent visitor objects (http://api.statcounter.com/docs/v3#visitors)
// https://laravel.com/docs/5.2/pagination
$stats = Stat::recentVisitors()->paginate(20);

// Add new project to StatCounter with the project name, project url, and project timezone
$project Stat::addProject('project-name','www.example.com','America/Chicago');
<html>
<body>

{!! Stat::tracker() !!}
</body>
</html>

The Versions

16/08 2014

v1.3.0

1.3.0.0 https://github.com/injic/laravel-statcounter

Laravel integration of the StatCounter API

  Sources   Download

MIT

The Requires

 

by James M Irvine

laravel statcounter

15/08 2014

v1.2.0

1.2.0.0 https://github.com/injic/laravel-statcounter

Laravel integration of the StatCounter API

  Sources   Download

MIT

The Requires

 

by James M Irvine

laravel statcounter

08/08 2014

v1.1

1.1.0.0 https://github.com/injic/laravel-statcounter

Laravel integration of the StatCounter API

  Sources   Download

MIT

The Requires

 

by James M Irvine

laravel statcounter

08/08 2014

v1.0

1.0.0.0

  Sources   Download

The Requires

 

by James M Irvine