2017 © Pedro Peláez
 

library geckoboard

A PHP library for dealing with Geckoboard API (http://www.geckoboard.com)

image

carlosio/geckoboard

A PHP library for dealing with Geckoboard API (http://www.geckoboard.com)

  • Thursday, May 26, 2016
  • by carlosbuenosvinos
  • Repository
  • 10 Watchers
  • 42 Stars
  • 100,083 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 36 Forks
  • 3 Open issues
  • 14 Versions
  • 7 % Grown

The README.md

CarlosIO\Geckoboard

Build Status Code Coverage Latest Stable Version Total Downloads Latest Unstable Version Scrutinizer Code Quality License SensioLabsInsight, (*1)

A PHP library for pushing data into Geckoboard custom widgets (http://www.geckoboard.com/developers/custom-widgets/widget-types), (*2)

Installation

The best way to install the library is by using Composer. Add the following to composer.json in the root of your project:, (*3)

``` javascript { "require": { "carlosio/geckoboard": "1.*" } }, (*4)


Then, on the command line: ``` bash curl -s http://getcomposer.org/installer | php php composer.phar install

Use the generated vendor/autoload.php file to autoload the library classes., (*5)

Usage

require __DIR__ . '/vendor/autoload.php';

use CarlosIO\Geckoboard\Widgets\NumberAndSecondaryStat;
use CarlosIO\Geckoboard\Client;

$widget = new NumberAndSecondaryStat();
$widget->setId('<your widget id>');
$widget->setMainValue(123);
$widget->setSecondaryValue(238);
$widget->setMainPrefix('EUR');

$geckoboardClient = new Client();
$geckoboardClient->setApiKey('<your token>');
$geckoboardClient->push($widget);

Widget: Number and optional secondary stat

Number and optional secondary stat, (*6)

use CarlosIO\Geckoboard\Widgets\NumberAndSecondaryStat;
use CarlosIO\Geckoboard\Client;

$widget = new NumberAndSecondaryStat();
$widget->setId('<your widget id>');
$widget->setMainValue(123);
$widget->setSecondaryValue(238);
$widget->setMainPrefix('EUR');

$geckoboardClient = new Client();
$geckoboardClient->setApiKey('<your token>');
$geckoboardClient->push($widget);

Widget: RAG numbers only

RAG numbers only, (*7)

use CarlosIO\Geckoboard\Data\Entry;
use CarlosIO\Geckoboard\Widgets\RagNumbers;
use CarlosIO\Geckoboard\Client;

$widget = new RagNumbers();
$widget->setId('<your widget id>');

$redData = new Entry();
$redData->setValue(132)->setText('This is the red description');
$widget->setRedData($redData);

$amberData = new Entry();
$amberData->setValue(134)->setText('This is the amber description');
$widget->setAmberData($amberData);

$greenData = new Entry();
$greenData->setValue(34)->setText('This is the green description');
$widget->setGreenData($greenData);

$geckoboardClient->push($widget);

Widget: RAG column and numbers

RAG column and numbers, (*8)

use CarlosIO\Geckoboard\Data\Entry;
use CarlosIO\Geckoboard\Widgets\RagColumnAndNumbers;
use CarlosIO\Geckoboard\Client;

$widget = new RagColumnAndNumbers();
$widget->setId('<your widget id>');

$redData = new Entry();
$redData->setValue(132)->setText('This is the red description');
$widget->setRedData($redData);

$amberData = new Entry();
$amberData->setValue(13)->setText('This is the amber description');
$widget->setAmberData($amberData);

$greenData = new Entry();
$greenData->setValue(3)->setText('This is the green description');
$widget->setGreenData($greenData);

$geckoboardClient->push($widget);

Widget: Text

Text, (*9)

use CarlosIO\Geckoboard\Widgets\Text;
use CarlosIO\Geckoboard\Data\Text\Item;
use CarlosIO\Geckoboard\Client;

$widget = new Text();
$widget->setId('<your widget id>');

$firstItem = new Item();
$secondItem = new Item();

$firstItem->setText('Test message 1');

$secondItem->setText('Test message 2');
$secondItem->setType(Item::TYPE_ALERT);

$widget->addItem($firstItem);
$widget->addItem($secondItem);

$geckoboardClient->push($widget);

Widget: Funnel

Funnel, (*10)

use CarlosIO\Geckoboard\Data\Funnel\Entry;
use CarlosIO\Geckoboard\Widgets\Funnel;

$widget = new Funnel();
$widget->setId('<your widget id>');
$widget->setType('reversed');
$widget->setShowPercentage(false);

$error = new Entry();
$error->setLabel('Step 1')->setValue(87809);
$widget->addEntry($error);

$error = new Entry();
$error->setLabel('Step 2')->setValue(70022);
$widget->addEntry($error);

$error = new Entry();
$error->setLabel('Step 3')->setValue(63232);
$widget->addEntry($error);

$error = new Entry();
$error->setLabel('Step 4')->setValue(53232);
$widget->addEntry($error);

$error = new Entry();
$error->setLabel('Step 5')->setValue(32123);
$widget->addEntry($error);

$error = new Entry();
$error->setLabel('Step 6')->setValue(23232);
$widget->addEntry($error);

$error = new Entry();
$error->setLabel('Step 7')->setValue(12232);
$widget->addEntry($error);

$error = new Entry();
$error->setLabel('Step 8')->setValue(2323);
$widget->addEntry($error);

$geckoboardClient->push($widget);

Widget: PieChart

PieChart, (*11)

use CarlosIO\Geckoboard\Data\PieChart\Entry;
use CarlosIO\Geckoboard\Widgets\PieChart;

$widget = new PieChart();
$widget->setId('<your widget id>');

$entry = new Entry();
$entry->setLabel('May')->setValue(100)->setColor('ffff10');
$widget->addEntry($entry);

$entry = new Entry();
$entry->setLabel('June')->setValue(160)->setColor('ffaa0a');
$widget->addEntry($entry);

$entry = new Entry();
$entry->setLabel('July')->setValue(300)->setColor('ff5505');
$widget->addEntry($entry);

$entry = new Entry();
$entry->setLabel('August')->setValue(140)->setColor('ff0000');
$widget->addEntry($entry);

$geckoboardClient->push($widget);

Widget: Geck-o-Meter

Geck-o-Meter, (*12)

use CarlosIO\Geckoboard\Data\Entry;
use CarlosIO\Geckoboard\Widgets\GeckoMeter;

$widget = new GeckoMeter();
$widget->setId('<your widget id>');

$widget->setMinData((new Entry())->setValue(0));
$widget->setMaxData((new Entry())->setValue(100));
$widget->setValue($data);

$geckoboardClient->push($widget);

Widget: Map

Map, (*13)

use CarlosIO\Geckoboard\Data\Point;
use CarlosIO\Geckoboard\Widgets\Map;

$widget = new Map();
$widget->setId('<your widget id>');

$point = new Point();
$point->setSize(10)->setColor('FF0000')->setLatitude('40.416775')->setLongitude('-3.70379');
$widget->addPoint($point);

$geckoboardClient->push($widget);

Widget: LineChart

Line Chart, (*14)

use CarlosIO\Geckoboard\Widgets\LineChart;

$widget = new LineChart();
$widget->setId('<your widget id>');
$widget->setItems(array(1, 1.23));
$widget->setColour("ff0000");
$widget->setAxis(LineChart::DIMENSION_X, array("min", "max"));
$widget->setAxis(LineChart::DIMENSION_Y, array("bottom", "top"));

$geckoboardClient->push($widget);

Widget: List

List, (*15)

use CarlosIO\Geckoboard\Data\ItemList\Label;
use CarlosIO\Geckoboard\Data\ItemList\Title;
use CarlosIO\Geckoboard\Widgets\ItemList;

$widget = new ItemList();
$widget->setId('<your widget id>');

$title = new Title();
$title->setText("Title text");
$title->setHighlight(true);

$title2 = new Title();
$title2->setText("Title2 text");
$title2->setHighlight(false);

$label = new Label();
$label->setName("Label name");
$label->setColor("red");

$label2 = new Label();
$label2->setName("Label2 name");
$label2->setColor("blue");

$widget->addItem($title, $label, 'description1');
$widget->addItem($title2, $label2, 'description2');

$geckoboardClient->push($widget);

Widget: Monitoring

Monitoring, (*16)

$widget = (new Monitoring())
    ->setId('<your widget id>')
    ->setStatus('Up')
    ->setDownTime('3 days ago')
    ->setResponseTime('100 ms');

$geckoboardClient()->push($widget);

Widget: LeaderBoard

Monitoring, (*17)

$widget = new LeaderBoard();
$widget->setId('<your widget id>')

$item = new Item();
$item->setLabel("Title text")
    ->setValue(10)
    ->setPreviousRank(2);
$widget->addItem($item);

$item = new Item();
$item->setLabel("Title text 2")
    ->setValue(7)
    ->setPreviousRank(1);
$widget->addItem($item);

$geckoboardClient()->push($widget);

Push more than one widget at the same time

$widgets = array();
$widget = new LineChart();
// Fill your line chart...
$widgets[] = $widget;

$widget = new Map();
// Fill your map...
$widgets[] = $widget;

$geckoboardClient->push($widgets);

Set timeout for pushing widgets

Use setGuzzleConfig() to pass config options directly to Guzzle., (*18)

$geckoboardClient = new Client();
$geckoboardClient->setApiKey('<your token>');
$geckoboardClient->setGuzzleConfig(array('timeout' => 30, 'connect_timeout' => 3));
$geckoboardClient->push($widget);

Testing

In order to run the test, install all dependencies: php composer.phar install, (*19)

$ bin/phpunit --coverage-text

The Versions

26/05 2016

dev-master

9999999-dev

A PHP library for dealing with Geckoboard API (http://www.geckoboard.com)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Raúl Fernández

21/07 2015

1.0.11

1.0.11.0

A PHP library for dealing with Geckoboard API (http://www.geckoboard.com)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Raúl Fernández

12/07 2015

1.0.10

1.0.10.0

A PHP library for dealing with Geckoboard API (http://www.geckoboard.com)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Raúl Fernández

08/06 2015

1.0.9

1.0.9.0

A PHP library for dealing with Geckoboard API (http://www.geckoboard.com)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Raúl Fernández

12/02 2015

dev-try-new-guzzle

dev-try-new-guzzle

A PHP library for dealing with Geckoboard API (http://www.geckoboard.com)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Raúl Fernández

12/02 2015

1.0.7

1.0.7.0

A PHP library for dealing with Geckoboard API (http://www.geckoboard.com)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Raúl Fernández

12/02 2015

1.0.8

1.0.8.0

A PHP library for dealing with Geckoboard API (http://www.geckoboard.com)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Raúl Fernández

14/12 2014

1.0.6

1.0.6.0

A PHP library for dealing with Geckoboard API (http://www.geckoboard.com)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Raúl Fernández

25/07 2014

1.0.5

1.0.5.0

A PHP library for dealing with Geckoboard API (http://www.geckoboard.com)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Raúl Fernández

24/07 2014

1.0.4

1.0.4.0

A PHP library for dealing with Geckoboard API (http://www.geckoboard.com)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Raúl Fernández

05/06 2014

1.0.3

1.0.3.0

A PHP library for dealing with Geckoboard API (http://www.geckoboard.com)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Raúl Fernández

29/05 2014

1.0.2

1.0.2.0

A PHP library for dealing with Geckoboard API (http://www.geckoboard.com)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Raúl Fernández

25/05 2014

1.0.1

1.0.1.0

A PHP library for dealing with Geckoboard API (http://www.geckoboard.com)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Raúl Fernández

24/05 2014

1.0.0

1.0.0.0

A PHP library for dealing with Geckoboard API (http://www.geckoboard.com)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Raúl Fernández