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
- easycorp/easyadmin-bundle: ^4
- knplabs/knp-menu: ^3.7
- symfony/config: ^7.3
- symfony/dependency-injection: ^7.3
- symfony/framework-bundle: ^7.3
- symfony/http-foundation: ^7.3
- symfony/http-kernel: ^7.3
- symfony/property-access: ^7.3
- symfony/twig-bundle: ^7.3
- symfony/validator: ^7.3
- symfony/yaml: ^7.3
- tourze/bundle-dependency: 1.*
- tourze/easy-admin-menu-bundle: 1.0.*
Requires (Dev)
This package is auto-updated.
Last update: 2025-11-11 10:40:37 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.