Download the PHP package nowo-tech/performance-bundle without Composer
On this page you can find all versions of the php package nowo-tech/performance-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nowo-tech/performance-bundle
More information about nowo-tech/performance-bundle
Files in nowo-tech/performance-bundle
Package performance-bundle
Short Description Symfony bundle for tracking and analyzing route performance metrics. Records request time, database queries count, and query execution time for performance analysis.
License MIT
Homepage https://github.com/nowo-tech/PerformanceBundle
Informations about the package performance-bundle
Performance Bundle
β Found this useful? Give it a star on GitHub! It helps us maintain and improve the project.
Symfony bundle for tracking and analyzing route performance metrics. Automatically records request time, database query count, and query execution time for performance analysis.
π Compatible with Symfony 7.x and 8.x - Requires PHP 8.2 or higher and Symfony 7.0 or higher.
This bundle is FrankenPHP worker mode friendly.
What is this?
This bundle helps you track and analyze route performance in your Symfony applications:
- π Automatic Performance Tracking - Automatically tracks route performance metrics
- π Query Analysis - Counts and times database queries per route
- β±οΈ Request Timing - Measures request execution time
- π Performance Analysis - Identifies slow routes and query-heavy endpoints
- π― Route Metrics - Stores metrics per route and environment
- π§ Manual Updates - Command to manually set/update route metrics
Quick Search Terms
Looking for: route performance, performance monitoring, query tracking, Symfony performance, route metrics, performance analysis, database query tracking, request timing, profiling, performance bundle? You've found the right bundle!
Features
- β Automatic route performance tracking via event subscribers
- β Database query counting and execution time tracking
- β Request execution time measurement
- β Memory usage tracking - Track peak memory consumption per route
- β Access frequency tracking - Track how often routes are accessed
- β HTTP status code tracking - Track and calculate ratios for HTTP status codes (200, 404, 500, etc.)
- β Sub-request tracking - Optional tracking of sub-requests (ESI, fragments, includes) in addition to main requests
- β Performance notifications - Email, Slack, Teams, and webhook notifications for performance alerts
- β Route data persistence in database
- β Environment-specific metrics (dev, test, prod)
- β Configurable route ignore list
- β Command to manually set/update route metrics
- β Support for multiple Doctrine connections
- β Performance dashboard with filtering and sorting
- β Data export - CSV and JSON export functionality
- β Record management - Delete individual records (optional)
- β Review system - Mark and edit records as reviewed with improvement tracking (optional)
- β Bootstrap and Tailwind CSS support - Choose your preferred CSS framework
- β Role-based access control for dashboard
- β WebProfiler integration with ranking information
- β Chart.js integration - Interactive performance charts
- β Symfony UX Twig Components - Optional modern component system
- β
Nowo UiKit + FormKit β dashboard chrome and admin forms (
nowo-tech/ui-kit-bundle,nowo-tech/form-kit-bundle,symfony/ux-icons) - β Symfony 7.x and 8.x compatible
- β
FrankenPHP β Compatible with FrankenPHP; production Caddyfile can use worker mode, while dev demos use
APP_ENV=devso the image entrypoint swaps inCaddyfile.dev(no worker, comfortable local dev). See docs/DEMO-FRANKENPHP.md and the demo READMEs.
Installation
Then, register the bundle in your config/bundles.php:
Quick Start
-
Configure the bundle (optional - works with defaults):
-
Create the database table(s):
Option A: Using the bundle commands (Recommended):
Option B: Using Doctrine Schema:
- That's it! The bundle will automatically track route performance metrics in the configured environments.
For detailed installation steps (including sync-schema and migrations), see Installation Guide.
Requirements
- PHP >= 8.2, < 8.6
- Symfony 7.x or 8.x
- Doctrine ORM ^2.13 || ^3.0
- Doctrine Bundle ^2.8 || ^3.0 (3.0 required for Symfony 8)
- nowo-tech/form-kit-bundle ^2.2, nowo-tech/ui-kit-bundle ^1.4, symfony/ux-icons (dashboard UI)
Configuration
The bundle works with default settings. Create config/packages/nowo_performance.yaml. For the full reference and all options, see Configuration Guide.
Usage
Automatic Tracking
The bundle automatically tracks performance metrics for all routes (except ignored ones) in configured environments.
Manual Metrics Update
Use the command to inject sample metrics through the same PerformanceMetricsService pipeline as HTTP tracking (updates RouteData; may append RouteDataRecord rows when enable_access_records is enabled β same rules as live requests):
Accessing Metrics
Commands
See Commands for full documentation. Main commands:
nowo:performance:create-table- Create or update the main metrics table (routes_data)nowo:performance:create-records-table- Create or update the access records table (routes_data_records); use whenenable_access_records: truenowo:performance:sync-schema- Sync both tables with entity metadata (add/alter columns)nowo:performance:set-route- Set or update route performance metrics manuallynowo:performance:diagnose- Diagnostic report of bundle configuration, tables, and tracking statusnowo:performance:check-dependencies- Check status of optional dependencies (UX Icons, Messenger, Mailer)nowo:performance:purge-records- Purge old access records (by age or all)nowo:performance:rebuild-aggregates- RebuildRouteDataaggregates from access records
How It Works
- Event Subscriber (
PerformanceMetricsSubscriber) listens to kernel events - On
KernelEvents::REQUEST, it starts tracking:- Request start time
- Query tracking is initialized by
QueryTrackingConnectionSubscriber(applies DBAL middleware and resets counters)
- On
KernelEvents::TERMINATE, it:- Calculates request time
- Collects query count and execution time using multiple strategies:
- Primary:
QueryTrackingMiddleware(DBAL middleware for DBAL 3.x compatibility) - Fallback 1:
DoctrineDataCollectorfrom Symfony profiler - Fallback 2: Request attributes (
_profiler,_profiler_profile) - Fallback 3: Stopwatch (time only)
- Persists via
PerformanceMetricsService: updatesRouteData(identity +lastAccessedAt); whenenable_access_recordsis on, inserts aRouteDataRecordfor that request (subject to deduplication and per-routesaveAccessRecords), unless metrics are recorded asynchronously (async: truewith Messenger)
Query Tracking Architecture
The bundle uses a multi-layered approach for query tracking:
- QueryTrackingMiddleware: A custom DBAL middleware that intercepts all database queries at the driver level. This is the primary method and works with DBAL 3.x (which removed
SQLLogger). - DoctrineDataCollector: Falls back to Symfony's built-in profiler data collector if the middleware is not available.
- Request Attributes: Attempts to access profiler data from request attributes for sub-requests.
- Stopwatch: Last resort fallback for timing information only (does not provide query count).
This ensures reliable query tracking across different Symfony and Doctrine versions.
Screenshots
The bundle provides a web dashboard to monitor and analyze route performance. Below are the main views.
Performance Metrics Dashboard
The main dashboard shows KPIs (total routes, records, average/max queries and request time), top routes by usage and by latency, filters (environment, sort, limit), an optional βOptional Dependencies Missingβ alert with composer require hints, a Performance Trends chart (average and max request time over days), and a Routes table with columns: route name, HTTP method, status codes, access count, environment, request time, query time, total queries, memory usage, last accessed at, access records link, and review status.
Access: dashboard path configured in nowo_performance.dashboard.path (e.g. /performance). Use Diagnose, Advanced Statistics, Export CSV/JSON, Access Statistics by Hour, and Clear All Records from the toolbar.
Advanced Performance Statistics
This view provides statistical analysis to find optimization targets: Performance Recommendations (e.g. high average query count, request time outliers), Correlation Analysis (request time vs query time, query time vs query count, memory vs request time), Efficiency Analysis (query time ratio), Traffic Distribution and hot/bad routes, Routes Needing Attention (high request time or query count by percentile), and detailed Request Time, Query Time, Query Count, Memory Usage, and Access Count sections with min/mean/median/max, percentiles, and distribution histograms.
Access: Advanced Statistics button from the main dashboard. Requires enough route data for meaningful stats.
Access Statistics by Hour
When temporal access records are enabled (enable_access_records: true), this page shows access patterns over time: filters (date range, environment, route, status code), Total Accesses and period, Statistics by Hour of Day (line chart: access count and average response time), Statistics by Day of Week and by Month (bar charts), Access Heatmap (day of week vs hour), and a detailed table by hour with access count, average response time, and status code breakdown. You can Delete records matching filter from here.
Access: Access Statistics by Hour from the main dashboard. Requires enable_access_records: true and the routes_data_records table (see Configuration).
Entity structure (v2.x)
Since 2.0.0, metrics are normalized: RouteData holds route identity and review metadata; per-request metrics live in RouteDataRecord (and dashboard/API use aggregates built from records). See ENTITY_NORMALIZATION_PLAN.md.
RouteData (routes_data) β one row per logical route + environment:
id,env,name,httpMethod,paramscreatedAt,lastAccessedAt- Review:
reviewed,reviewedAt,reviewedBy,queriesImproved,timeImproved saveAccessRecordsβ when access records are enabled globally, you can disable per-route record creation
RouteDataRecord (routes_data_records) β optional temporal log when enable_access_records: true (one row per request, deduplicated by request_id when set):
- Timing and load:
responseTime,totalQueries,queryTime,memoryUsage,statusCode,accessedAt - Context:
route_params,route_path,referer,user_identifier,user_id,request_id
Listed metrics (request time, query counts, status code ratios, etc.) in the UI and exports are computed from records (or cached aggregates), not stored as scalar columns on RouteData.
Documentation
- GitHub Actions CI requirements
- Installation
- Configuration
- PSR evaluation (REQ-CS-007)
- Usage
- Contributing
- Code of Conduct
- Changelog
- Upgrading
- Release
- Security
- Engram
- Spec-driven development
- GitHub Spec Kit
- Roadmap
Additional documentation
- Demo with FrankenPHP (development and production)
- Commands
- Events & priorities
- Behaviour and notable changes
- Compatibility
- Notifications
Testing
Tests and coverage
- Tests: PHPUnit (PHP)
- PHP: ~99% lines (run
make test-coveragefor the current summary; badge rounded)
License
The MIT License (MIT). Please see LICENSE for more information.
Contributing
We welcome contributions! Please see CONTRIBUTING.md for details.
Author
Created by HΓ©ctor Franco Aceituno at Nowo.tech
All versions of performance-bundle with dependencies
doctrine/doctrine-bundle Version ^2.8 || ^3.0
doctrine/orm Version ^2.13 || ^3.0
nowo-tech/form-kit-bundle Version ^2.2
nowo-tech/ui-kit-bundle Version ^1.4
php Version >=8.2 <8.6
symfony/form Version ^7.0 || ^8.0
symfony/framework-bundle Version ^7.0 || ^8.0
symfony/security-bundle Version ^7.0 || ^8.0
symfony/stopwatch Version ^7.0 || ^8.0
symfony/translation Version ^7.0 || ^8.0
symfony/twig-bundle Version ^7.0 || ^8.0
symfony/ux-icons Version ^2.0 || ^3.0
symfony/var-exporter Version ^7.0 || ^8.0
symfony/yaml Version ^7.0 || ^8.0
twig/extra-bundle Version ^3.12
twig/string-extra Version ^3.12