async / amp-sql-profiler-bundle
Amp SQL profiler for Symfony WebProfilerBundle.
Installs: 78
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^8.2
- amphp/sql: ^2
- scriptfusion/static-class: ^1
- symfony/web-profiler-bundle: ^6
This package is auto-updated.
Last update: 2024-10-10 23:46:52 UTC
README
If you use Amp with Symfony then you are probably based, but that means Doctrine will be useless (except perhaps its query builder), so you can't use the handy query profiler from DoctrineBundle. This is the missing SQL profiler for Amp.
Features
Profiles Amp SQL connections in Symfony applications and displays the results in the Symfony Profiler toolbar.
- Shows query summary in toolbar view.
- Shows full query details in profiler view.
- Supports transactions.
- Supports backtraces.
Limitations
Using an unsupported feature may throw NotImplementedException
.
- Does not support prepared statements.
- Does not support transaction save points.
Installation
Add the bundle to your project with Composer.
composer require --dev async/amp-sql-profiler-bundle
If Symfony Flex is installed, it should update bundles.php
automatically with a line similar to the following.
ScriptFUSION\AmpSqlProfilerBundle\AmpSqlProfilerBundle::class => ['dev' => true, 'test' => true],
We recommend removing the 'test'
key and only running the bundle in dev
. If Flex is not available, the line can be added manually.
To enable profiling, all instances of Amp\Sql\Pool
must be replaced with ProfiledPool
at dependency injection time. To do this, add the following line to services_dev.yaml
.
# Enable Amp SQL profiling. Amp\Sql\Pool: factory: '@ScriptFUSION\AmpSqlProfilerBundle\ProfiledPoolFactory'
Unfortunately, this will create a circular reference because ProfiledPoolFactory
creates an instance of ProfiledPool
which requires an instance of Amp\Sql\Pool
. This can be resolved by specifying the specific implementation of the Pool that we want to profile. For example, the following configuration may suffice to profile Postgres.
ScriptFUSION\AmpSqlProfilerBundle\ProfiledPool: arguments: - '@Amp\Postgres\PostgresConnectionPool' Amp\Postgres\PostgresConnectionPool: ~