2017 © Pedro Peláez
 

library guzzle-addons-mozilla

An API client for the Mozilla Addons statistics based on Guzzle PHP

image

ajt/guzzle-addons-mozilla

An API client for the Mozilla Addons statistics based on Guzzle PHP

  • Monday, May 6, 2013
  • by arendjantetteroo
  • Repository
  • 1 Watchers
  • 0 Stars
  • 67 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

guzzle-addons-mozilla

A simple PHP API client for the Mozilla Addon Statistics service, (*1)

Installation

The library is available through Composer, so its easy to get it. Simply add this to your composer.json file:, (*2)

"require": {
    "ajt/guzzle-addons-mozilla": "dev-master"
}

And run composer install, (*3)

Features

  • Support the current statistics per day

Todo

  • [ ] Add tests
  • [ ] Add some Response models
  • [ ] Figure out if there is a way to login so private statistics work as well

Usage

You need to have a public statistics board for this to work, as of now there is no support for authentication, (*4)

To use the Mozilla Addons API Client simply instantiate the client, (*5)

<?php

require dirname(__FILE__).'/../vendor/autoload.php';

use AJT\MozillaAddons\MozillaAddonsClient;

/**
 * For example, for the JSON-handle dashboard :
 * https://addons.mozilla.org/en-us/firefox/addon/JSON-handle/statistics/?last=30
 * @var string
 */
$app_name = 'JSON-handle'; // Fill in your appname here

// Get the client
$client = MozillaAddonsClient::factory(array('app_name' => $app_name, 'debug' => false));

// Get downloads
print "getDownloadsPerDay\n";
$downloads = $client->getDownloadsPerDay(array('date_start' => '20130504', 'date_end' => '20130506'));
print_r($downloads);

Invoke Commands using our __call method (auto-complete phpDocs are included), (*6)

<?php 
// Get the client
$client = MozillaAddonsClient::factory(array('app_name' => $app_name, 'debug' => false));

// Get downloads
print "getDownloadsPerDay\n";
$downloads = $client->getDownloadsPerDay(array('date_start' => '20130504', 'date_end' => '20130506'));
print_r($downloads);

Examples

Copy the api.config.php.dist to api.config.php andd fill in the app-name. Afterwards you can execute the example getUsage.php in the examples directory., (*7)

You can look at the services.json for details on what methods are available and what parameters are available to call them, (*8)

Contributions welcome

Found a bug, open an issue, preferably with the debug output and what you did. Bugfix? Open a Pull Request and i'll look into it., (*9)

License

The Mozilla Addons API client is available under an MIT License., (*10)

The Versions

06/05 2013

dev-master

9999999-dev

An API client for the Mozilla Addons statistics based on Guzzle PHP

  Sources   Download

MIT

The Requires