1. Go to this page and download the library: Download devhelp/piwik-bundle 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/ */
devhelp / piwik-bundle example snippets
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
//...
new \Devhelp\PiwikBundle\DevhelpPiwikBundle(),
//...
);
//...
return $bundles;
}
//...
}
namespace Acme\DemoBundle\Service;
use Devhelp\Piwik\Api\Api;
class MyService
{
/**
* @var Api
*/
private $piwikApi;
public function __construct(Api $piwikApi)
{
$this->piwikApi = $piwikApi;
}
public function doSomething()
{
//...
$this->piwikApi->getMethod('PiwikPlugin.pluginAction')->call();
//...
}
}
namespace Acme\DemoBundle\Param;
use Devhelp\Piwik\Api\Param\Param;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
class MyTokenAuthProvider implements Param
{
/**
* @var TokenStorageInterface
*/
private $tokenStorage;
public function __construct(TokenStorageInterface $tokenStorage)
{
$this->tokenStorage = $tokenStorage;
}
public function value()
{
$token = $this->tokenStorage->getToken();
return $token instanceof TokenInterface ? $token->getUser()->getPiwikToken() : null;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.