1. Go to this page and download the library: Download serginhold/phalcon-profiler 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/ */
serginhold / phalcon-profiler example snippets
use Phalcon\Di\DiInterface;
use Phalcon\Mvc\Application;
use SerginhoLD\Phalcon\WebProfiler\WebProfiler;
/** @var DiInterface $di */
if ('dev' === $env) {
$di->register(new WebProfiler());
}
/** @var Application $application */
$application->setEventsManager($di->getShared('eventsManager'));
$container->setShared('devLoggerAdapter', function () use ($container) {
return $container->has('profilerLoggerAdapter')
? $container->getShared('profilerLoggerAdapter')
: new \Phalcon\Logger\Adapter\Noop();
});
use Phalcon\Di\DiInterface;
use Phalcon\Di\ServiceProviderInterface;
class StopwatchProvider implements ServiceProviderInterface
{
public function register(DiInterface $di): void
{
$di->setShared('stopwatch', function () use ($di) {
return $di->has('profilerStopwatch') ? $di->getShared('profilerStopwatch') : null;
});
}
}
use SerginhoLD\Phalcon\WebProfiler\Collector\CollectorInterface;
class CustomCollector implements CollectorInterface
{
public function templatePath(): string
{
return '/var/www/templates/custom'; // .volt
}
public function name(): string
{
return 'Custom';
}
public function icon(): string
{
return '';
}
public function collect(): array
{
return [
'message' => 'hello',
];
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.