2017 © Pedro PelĂĄez
 

symfony-bundle ducksboard-bundle

Symfony2 Bundle to integrate an app with Ducksboard.

image

sfm/ducksboard-bundle

Symfony2 Bundle to integrate an app with Ducksboard.

  • Monday, August 13, 2012
  • by moisesgallego
  • Repository
  • 1 Watchers
  • 7 Stars
  • 437 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

DucksboardBundle for Symfony2

Build Status, (*1)

This bundle integrates Symfony2 applications with the Ducksboard API., (*2)

Dependencies

PHP Curl library http://php.net/manual/en/book.curl.php, (*3)

Instalation

With composer

Add the project in the composer.json file:, (*4)

...
"require": {
...
    "sfm/ducksboard-bundle": "dev-master"
...
}

and in the AppKernel.php file:, (*5)

    $bundles = array(
        ...
        new SFM\DucksboardBundle\SFMDucksboardBundle(),
    ...
        );

Execute php composer.phar install, (*6)

With deps files

Add the project in the deps file:, (*7)

[DucksboardBundle]
    git=https://github.com/mgallego/DucksboardBundle.git
    target=/bundles/SFM/DucksboardBundle

and in the `autoload.php' file:, (*8)

$loader->registerNamespaces(array(
    ...
    'SFM'         => __DIR__.'/../vendor/bundles',
    ...

and in the AppKernel.php file:, (*9)

    $bundles = array(
        ...
        new SFM\DucksboardBundle\SFMDucksboardBundle(),
    ...
        );

Use like an own service

First you need to include the Ducksboard apiKey into the parameters file (ini/yml):, (*10)

ducksboard_api    =  xxxxxxxxxxxxxxx

Second, create the service:, (*11)

services:
...
...
    example.ducksboard:
        class: SFM\DucksboardBundle\Adapter\Widget
        arguments: [@sfm.ducksboard.connector]  
        calls:
            - [setApiKey, [%ducksboard_api%]]

Now you can use your own service that set automatically the apikey, (*12)

Use the bundle service

The bundle has a service prepared to use. Example:, (*13)

$widget = $this->container->get('sfm.ducksboard.widget');
$widget->setApiKey($this->container->getParameter('ducksboard_api'));

Examples of use

Push method

Simple Widget, (*14)

        $widget = $this->container->get('screencast.ducksboard');
        $widget->setData(array($widgetID => array('value' => $val1)));
        $widget->push();

Double Widget, (*15)

        $widget = $this->container->get('screencast.ducksboard');
        $dateData1 = array(
            array('timestamp' => time(), 'value' => '130'),
            array('timestamp' => time() - ((24*60*60)) , 'value' => '50'),
            array('timestamp' => time() - ((2*24*60*60)) , 'value' => '70'),
            array('timestamp' => time() - ((3*24*60*60)) , 'value' => '20'),
            array('timestamp' => time() - ((4*24*60*60)) , 'value' => '50'),
            array('timestamp' => time() - ((4*24*60*60)) , 'value' => '80'),
            array('timestamp' => time() - ((4*24*60*60)) , 'value' => '100'));

        $dateData2 = array(
            array('timestamp' => time(), 'value' => '80'),
            array('timestamp' => time() - ((24*60*60)) , 'value' => '20'),
            array('timestamp' => time() - ((2*24*60*60)) , 'value' => '70'),
            array('timestamp' => time() - ((3*24*60*60)) , 'value' => '80'),
            array('timestamp' => time() - ((4*24*60*60)) , 'value' => '50'),
            array('timestamp' => time() - ((4*24*60*60)) , 'value' => '90'),
            array('timestamp' => time() - ((4*24*60*60)) , 'value' => '30'));

        $widgetGraphData = array(
            $widgetId1=> $dateData1,
            $widgetId2 => $dateData2
            );

        $widget->setData($widgetGraphData);
        $widget->push();

Delta Values, (*16)

        $widget = $this->container->get('screencast.ducksboard');
    $widgetData = array($widgetId => array('delta' => 1 ));
    $widget->setData($widgetData);
    $widget->push();

Pull method

Get the 3 last data of a widget, (*17)

   $widget->getLastValues($widgetId, 3);
   $widgetActualData = $widget->getArrayResponse();          
   //or
   $widgetActualData = $widget->getRawResponse();            

Find data by seconds, (*18)

   $widget->findBySeconds($widgetId, $seconds);
   $widgetActualData = $widget->getArrayResponse();          
   //or
   $widgetActualData = $widget->getRawResponse();            

Find data by timespan, (*19)

   $widget->findByTimespan($widgetId, 'monthly', $timezone);
   $widgetActualData = $widget->getArrayResponse();          
   //or
   $widgetActualData = $widget->getRawResponse();            

Other resources

Oficial Ducskboard API documentation: http://ducksboard.com/our-apis/, (*20)

A Demo video with examples (spanish): https://vimeo.com/46636287, (*21)

The Versions

13/08 2012

dev-Dev

dev-Dev

Symfony2 Bundle to integrate an app with Ducksboard.

  Sources   Download

MIT

The Requires

 

symfony2 ducksboard

13/08 2012

dev-master

9999999-dev

Symfony2 Bundle to integrate an app with Ducksboard.

  Sources   Download

MIT

The Requires

 

symfony2 ducksboard

13/08 2012

v0.1

0.1.0.0

Symfony2 Bundle to integrate an app with Ducksboard.

  Sources   Download

MIT

The Requires

 

symfony2 ducksboard