PHP code example of bi0r0b0t / silex-pinba-provider
1. Go to this page and download the library: Download bi0r0b0t/silex-pinba-provider 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/ */
bi0r0b0t / silex-pinba-provider example snippets
/**
* @var $app Silex\Application
*/
$app->register(new SilexPinbaProvider\SilexPinbaProvider()
/**
* @var $app Silex\Application
*/
$app['orm.cache.factory.filesystem'] = $app->protect(function($cacheOptions) use ($app) {
if (empty($cacheOptions['path'])) {
throw new \RuntimeException('FilesystemCache path not defined');
}
$cache = new SilexPinbaProvider\Cache\Filesystem($cacheOptions['path']);
$cache->setStopwatch($app['intaro_pinba.stopwatch']);
return $cache;
});
/**
* @var $app Silex\Application
*/
$app['orm.cache.factory.backing_memcache'] = $app->protect(function() use ($app) {
$cache = new Intaro\PinbaBundle\Cache\Memcache();
$cache->setStopwatch($app['intaro_pinba.stopwatch']);
return $cache;
});
/**
* @var $console Symfony\Component\Console\Application
* @var $app Silex\Application
*/
if (function_exists('pinba_script_name_set')) {
pinba_script_name_set('console');
$input = new Symfony\Component\Console\Input\ArgvInput();
$timer = pinba_timer_start(array(
'server' => $app['intaro_pinba.server.name'],
'group' => 'console::run',
'command' => $input->getFirstArgument(),
));
$res = $console->run($input);
pinba_timer_stop($timer);
return $res;
} else {
return $console->run();
}