1. Go to this page and download the library: Download carlosio/geckoboard library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
carlosio / geckoboard example snippets
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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 = (new Monitoring())
->setId('<your widget id>')
->setStatus('Up')
->setDownTime('3 days ago')
->setResponseTime('100 ms');
$geckoboardClient()->push($widget);
$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);
$widgets = array();
$widget = new LineChart();
// Fill your line chart...
$widgets[] = $widget;
$widget = new Map();
// Fill your map...
$widgets[] = $widget;
$geckoboardClient->push($widgets);