valksor / php-spx-profiler
A Symfony profiler data collector for the SPX PHP profiler, which collects and displays profiling data for PHP applications
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/valksor/php-spx-profiler
Requires
Suggests
- ext-spx: *
- symfony/twig-bundle: *
This package is auto-updated.
Last update: 2025-10-29 19:32:19 UTC
README
A Symfony profiler data collector for the SPX PHP profiler, which collects and displays detailed profiling data for PHP applications. This component integrates SPX profiling directly into the Symfony web profiler for easy access to performance metrics during development.
Installation
Install the package via Composer:
composer require valksor/php-spx-profiler
Requirements
- PHP 8.4 or higher
- SPX PHP extension installed and configured
- Symfony Framework (7.2.0 or higher)
- Valksor Bundle for automatic configuration
Basic Usage
The SpxProfiler component provides a data collector for the Symfony web profiler that integrates with the SPX PHP profiler. It allows you to view detailed profiling information for your PHP applications directly in the Symfony web profiler.
Basic Setup
- Install the SPX PHP extension (https://github.com/NoiseByNorthwest/php-spx)
- Enable the extension in your php.ini:
extension=spx.so spx.http_enabled=1 spx.http_key=your_secret_key
- Register the component in your Symfony application:
// config/bundles.php return [ // ... Valksor\Bundle\ValksorBundle::class => ['all' => true], // ... ];
- Configure the component in your Symfony application:
# config/packages/valksor.yaml valksor: components: spx_profiler: ~
Features
The SpxProfiler component provides comprehensive profiling integration for Symfony applications:
- Symfony Profiler Integration: Seamless integration with Symfony's web profiler toolbar
- SPX Data Collection: Automatic collection and display of detailed SPX profiling metrics
- Real-time Performance Metrics: Wall time, memory usage, call graphs, and execution traces
- Request Matching: Automatic matching of SPX reports with Symfony profiler requests
- Configurable Profiling: Support for different SPX modes and data collection options
- Development Workflow: Streamlined profiling setup for development environments
Viewing Profiling Data
Once the component is installed and configured, you can view profiling data in the Symfony web profiler:
- Enable SPX profiling for a request by adding the SPX_KEY parameter to the URL or setting the SPX_ENABLED cookie to 1
- Make a request to your application
- Open the Symfony web profiler for that request
- Click on the SPX tab to view the profiling data
Features
The SpxProfiler component provides the following features:
- Integration with the Symfony web profiler
- Display of SPX profiling data in a dedicated tab
- Automatic matching of SPX reports with Symfony profiler requests
- Display of detailed metrics including:
- Wall time
- Memory usage
- Enabled metrics
- Recorded calls
 
- Links to the full SPX report for more detailed analysis
Configuration Options
The SPX PHP extension provides several configuration options that can be set in your php.ini:
- spx.http_enabled: Enable HTTP interface (default: 0)
- spx.http_key: Secret key for HTTP interface
- spx.http_ip_whitelist: IP whitelist for HTTP interface
- spx.data_dir: Directory for SPX data files (default: /tmp/spx)
Contributing
Contributions are welcome! Please read our Contributing Guidelines for details on:
- Code style requirements (PSR-12)
- Testing requirements for PRs
- One feature per pull request
- Development setup instructions
To contribute to SpxProfiler component:
- Fork the repository
- Create a feature branch (git checkout -b feature/spx-enhancement)
- Implement your enhancement following existing patterns
- Add comprehensive tests for new functionality
- Ensure all tests pass and code style is correct
- Submit a pull request
Adding New Profiling Features
When adding new profiling functionality:
- Extend the data collector to capture additional metrics
- Update Twig templates for displaying new data
- Add configuration options for new features
- Test integration with SPX extension
- Update documentation with examples
Security
If you discover any security-related issues, please email us at security@valksor.dev instead of using the issue tracker.
For security policy and vulnerability reporting guidelines, please see our Security Policy.
Support
- Documentation: Full documentation
- Issues: GitHub Issues for bug reports and feature requests
- Discussions: GitHub Discussions for questions and community support
- Stack Overflow: Use tag valksor-php-spx-profiler
- SPX Extension: SPX GitHub for extension-specific issues
Credits
- Original Author - Creator and maintainer
- All Contributors - Thank you to all who contributed
- SPX Author - Creator of the SPX PHP profiler extension
- Symfony Profiler Team - Profiler framework and best practices inspiration
- Valksor Project - Part of the larger Valksor PHP ecosystem
License
This package is licensed under the BSD-3-Clause License.
About Valksor
This package is part of the valksor/php-valksor project - a comprehensive PHP library and Symfony bundle that provides a collection of utilities, components, and integrations for Symfony applications.
The main project includes:
- Various utility functions and components
- Doctrine ORM tools and extensions
- API Platform integrations
- Symfony bundle for easy configuration
- And much more
If you find this SpxProfiler component useful, you might want to check out the full Valksor project for additional tools and utilities that can enhance your Symfony application development.
To install the complete package:
composer require valksor/php-valksor