core23/piwik-bundle

This bundle provides a block service for using Piwik inside the sonata-project.

2.0.0 2017-09-14 08:05 UTC

README

Latest Stable Version Latest Unstable Version License

Build Status Scrutinizer Code Quality Code Climate Coverage Status SensioLabsInsight

Donate to this project using Flattr Donate to this project using PayPal

This bundle provides a wrapper for using the piwik statistic inside the symfony sonata-project.

Installation

php composer.phar require core23/piwik-bundle
php composer.phar require php-http/guzzle6-adapter # if you want to use Guzzle

Enabling the bundle

    // app/AppKernel.php

    public function registerBundles()
    {
        return array(
            // ...
            
            new Http\HttplugBundle\HttplugBundle(),
            new Core23\PiwikBundle\Core23PiwikBundle(),

            // ...
        );
    }

Define a HTTPlug client in your configuration.

    config.yml
    
    httplug:
        classes:
            client: Http\Adapter\Guzzle6\Client
            message_factory: Http\Message\MessageFactory\GuzzleMessageFactory
            uri_factory: Http\Message\UriFactory\GuzzleUriFactory
            stream_factory: Http\Message\StreamFactory\GuzzleStreamFactory

Usage

{# template.twig #}

{{ sonata_block_render({ 'type': 'core23.piwik.block.statistic' }, {
    'host': 'http://piwik.example.com',
    'site': 1,
    'token': 'PIWIK_API_TOKEN'
}) }}

This bundle is available under the MIT license.