PHP code example of zanbug / symfony
1. Go to this page and download the library: Download zanbug/symfony 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/ */
zanbug / symfony example snippets
// config/bundles.php
return [
// ...
Zanbug\Symfony\ZanbugBundle::class => ['all' => true],
];
public function registerBundles()
{
$bundles = [
// ...
new Zanbug\Symfony\ZanbugBundle(),
];
return $bundles;
}
use Zanbug\Sdk\Zanbug;
try {
// ...
} catch (\Throwable $e) {
Zanbug::capture($e);
}
// Or a message:
Zanbug::captureMessage('Something noteworthy happened', 'warning');
if (interface_exists(\Doctrine\DBAL\Logging\SQLLogger::class)) {
$connection->getConfiguration()->setSQLLogger(new \Zanbug\Symfony\Doctrine\ZanbugSqlLogger());
}
\Zanbug\Sdk\Zanbug::recordQuery($sql, $durationMs, ['connection' => 'mysql', 'bindings' => $params]);
\Zanbug\Sdk\Zanbug::init([
'api_key' => 'bb_xxxxxxxx',
'host' => 'https://zanbug.com',
'capture_logs' => true,
'log_level' => 'error', // minimum PSR level forwarded
]);
// Any framework — from your log pipeline or directly:
\Zanbug\Sdk\Zanbug::recordLog('error', 'Import failed', ['file' => $name]);
// Caught-and-logged throwable (attach it for a full stacktrace):
try { risky(); } catch (\Throwable $e) {
\Zanbug\Sdk\Zanbug::recordLog('error', $e->getMessage(), ['exception' => $e]);
}