tourze / symfony-rotate-profile-storage-bundle
A Symfony bundle that provides automatic rotation and cleanup for Symfony Profiler storage files to prevent disk space issues
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/tourze/symfony-rotate-profile-storage-bundle
Requires
- php: ^8.1
- symfony/config: ^6.4
- symfony/dependency-injection: ^6.4
- symfony/framework-bundle: ^6.4
- symfony/http-foundation: ^6.4
- symfony/http-kernel: ^6.4
- symfony/yaml: ^6.4 || ^7.1
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2025-11-01 19:26:58 UTC
README
A Symfony bundle that provides automatic rotation and cleanup for Symfony Profiler storage files to prevent disk space issues.
Installation
composer require tourze/symfony-rotate-profile-storage-bundle
Quick Start
This bundle automatically decorates the default Symfony profiler storage and provides automatic cleanup of old profiler files when the number of profiles exceeds a configurable limit.
Basic Usage
- Install the bundle via Composer
- The bundle will automatically register itself in your Symfony application
- Configure the rotation settings (optional)
Configuration
You can configure the rotation behavior using environment variables:
# Set the maximum number of profiles to keep (default: 1000)
ROTATE_PROFILE_STORAGE_KEEP_SIZE=1000
Features
- Automatic Rotation: Automatically cleans up old profiler files when the limit is reached
- Configurable Limits: Set custom limits for the number of profiles to keep
- Transparent Integration: Works seamlessly with existing Symfony profiler functionality
- Error Handling: Gracefully handles cleanup errors without affecting application performance
Example
// The bundle works automatically once installed // No manual configuration required // Optional: Set environment variable for custom limits $_ENV['ROTATE_PROFILE_STORAGE_KEEP_SIZE'] = 500;
How It Works
The bundle uses a decorator pattern to wrap the default Symfony profiler storage:
- When a new profile is written, it checks the current number of stored profiles
- If the count exceeds the configured limit, it triggers a cleanup
- The cleanup process removes old profiler files to free up disk space
- All operations are delegated to the original storage implementation
Requirements
- PHP 8.1 or higher
- Symfony 7.3 or higher
License
This bundle is released under the MIT License. See the LICENSE file for details.