PHP code example of rizalmf / slim-simple-profiler
1. Go to this page and download the library: Download rizalmf/slim-simple-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/ */
rizalmf / slim-simple-profiler example snippets
use Simple\Profiler\Profiler;
use Simple\Profiler\Container;
iler(new Container()));
// ...
$container = new Container();
$container->setDarkMode(false);
$app->add(new Profiler($container));
//-------- OPTION ONE --------//
// in case you use static Manager
// ...
$DB = new \Illuminate\Database\Capsule\Manager();
$DB->addConnection($settings['your_eloquent_cfg']);
$DB->setAsGlobal();
$DB->bootEloquent();
// register to container
$container->setEloquentManager($DB);
// add middleware
$app->add(new Profiler($container));
//-------- OPTION TWO --------//
// in case you set eloquent to slim container
// ...
$settings = re
$app->add(new Profiler($container));
// ...
$settings = pp($settings);
$appContainer = $app->getContainer();
$appContainer['dao'] = function ($c) {
$settings = $c->get('settings');
$config = \Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration(
$settings['doctrine']['meta']['entity_path'],
$settings['doctrine']['meta']['auto_generate_proxies'],
$settings['doctrine']['meta']['proxy_dir'],
$settings['doctrine']['meta']['cache'],
false
);
return \Doctrine\ORM\EntityManager::create($settings['doctrine']['connection'], $config);
};
// first.. you have to bind DebugStack to your entityManager
$logger = new \Doctrine\DBAL\Logging\DebugStack();
$appContainer['dao']->getConnection()
->getConfiguration()
->setSQLLogger($logger);
// register DebugStack to container
$container->setDoctrineStack($logger);
// add middleware
$app->add(new Profiler($container));
// ...
$stack = \GuzzleHttp\HandlerStack::create();
$stack->push(\Simple\Profiler\Profiler::guzzleStack());
// set options \GuzzleHttp\Client
$options['handler'] = $stack;
$client = new \GuzzleHttp\Client($options);
// ...
$container = new Container();
// response as text/html
$container->setResponseFormat(Container::HTTP_FORMAT);
// response as application/json content-type
$container->setResponseFormat(Container::JSON_FORMAT);
$app->add(new Profiler($container));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.