conserto/pomm-symfony-bridge
Symfony bridge for Pomm, providing a profiler integration for the full-stack framework. Fork of the original pomm-symfony-bridge and typically installed via conserto/pomm-bundle rather than directly.
Installation Add the package via Composer (now requires Symfony 8+):
composer require conserto/pomm-symfony-bridge:^6.0
Register the bundle in config/bundles.php (Symfony 8+):
return [
// ...
Conserto\PommSymfonyBridge\PommSymfonyBridgeBundle::class => ['all' => true],
];
Enable Profiling Add the profiler to Symfony 8's profiler toolbar:
# config/packages/dev/profiler.yaml
framework:
profiler:
collectors:
pomm: true
First Use Case
Inject the Pomm\Client into a service and use it as usual. The profiler will automatically capture:
/_profiler/pomm in dev mode.Symfony 8 Dependency Injection
Bind Pomm\Client using Symfony 8's autowiring or explicit configuration:
# config/services.yaml
services:
App\Services\DatabaseService:
arguments:
$pommClient: '@pomm.client'
Query Logging Middleware (Symfony 8) Extend the profiler to log queries using Symfony 8's event system:
use Conserto\PommSymfonyBridge\EventListener\PommProfilerListener;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
class CustomPommListener {
#[AsEventListener(event: 'pomm.query.executed')]
public function onQueryExecuted(PommQueryEvent $event) {
// Custom logic (e.g., log to Sentry)
}
}
Performance Comparison with Symfony 8 Use the profiler to compare query performance across environments:
$profiler = $this->container->get('profiler');
$data = $profiler->loadProfile('pomm')->getData();
symfony/dependency-injection and symfony/http-kernel v6.x.Pomm\Client calls in Symfony 8's MessengerComponent.PommDataCollector to add domain-specific metrics (Symfony 8's DataCollector interface):
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class CustomPommDataCollector extends PommDataCollector {
public function collect(Request $request, Response $response, \Throwable $exception = null) {
// Custom logic for Symfony 8
}
}
Symfony 8 Dependency The package requires Symfony 8+. Ensure your project is upgraded:
composer require symfony/*:^6.0
Dev-Only Feature The profiler is disabled in production by default. Avoid relying on profiler data in non-dev environments.
Memory Overhead Complex queries with large resultsets may increase memory usage. Disable profiling for bulk operations:
$client->getProfiler()->disable();
pomm.client is properly configured in Symfony 8's DI container and the profiler is enabled.Custom Profiler Data
Override PommDataCollector::collect() to add custom metrics (Symfony 8 compatible):
public function collect(Request $request, Response $response, \Throwable $exception = null) {
$profiler = $this->getPommProfiler();
$profiler->addCustomData('app_metric', $this->calculateCustomMetric());
}
Query Filtering Filter profiled queries by type or namespace (Symfony 8 event system):
$profiler->setQueryFilter(function ($query) {
return strpos($query->getSql(), 'SELECT') !== false;
});
Profiler Storage Persist profiler data to a database for historical analysis (Symfony 8 compatible):
$profiler->setStorage(new DoctrinePommProfilerStorage($entityManager));
How can I help you explore Laravel packages today?