Download the PHP package tourze/symfony-memory-watch-bundle without Composer
On this page you can find all versions of the php package tourze/symfony-memory-watch-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package symfony-memory-watch-bundle
Symfony Memory Watch Bundle
中文
A Symfony bundle that monitors and logs memory usage in your application during the request lifecycle.
Features
- Monitors memory usage between request and response
- Logs warnings when memory usage exceeds defined thresholds
- Zero configuration required to get started
- Works with Symfony's PSR-compatible logging
- Lightweight with minimal performance impact
Installation
Register the bundle
For Symfony applications using Flex, the bundle should be automatically registered. Otherwise, add it manually to your config/bundles.php:
Quick Start
After installation, the bundle is ready to use with zero configuration. It will automatically:
- Monitor memory usage - Track memory consumption for each request
- Log warnings - Alert when memory usage exceeds 50MB threshold
- Clean up automatically - Use WeakMap to prevent memory leaks
The bundle logs to your application's default logger when memory usage exceeds the threshold. Check your logs to see output like:
No additional configuration is required - the bundle works out of the box.
How It Works
The bundle uses an event subscriber to:
- Record memory usage at the beginning of the request
- Measure memory usage at the end of the request
- Log a warning when the difference exceeds the configured threshold
Memory usage data is collected using PHP's memory_get_usage() function. The bundle uses a WeakMap to associate memory measurements with request objects, ensuring no memory leaks occur.
Requirements
- PHP 8.1+
- Symfony 6.4+
- PSR-compatible logger
Contributing
Contributions are welcome! Feel free to submit a pull request.
License
The MIT License (MIT). Please see License File for more information.
All versions of symfony-memory-watch-bundle with dependencies
psr/log Version ^3|^2|^1
symfony/config Version ^7.3
symfony/dependency-injection Version ^7.3
symfony/event-dispatcher Version ^7.3
symfony/framework-bundle Version ^7.3
symfony/http-foundation Version ^7.3
symfony/http-kernel Version ^7.3
symfony/monolog-bundle Version ^3.10
symfony/property-access Version ^7.3
symfony/yaml Version ^7.3
tourze/bundle-dependency Version 1.*
tourze/symfony-dependency-service-loader Version 1.0.*