New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

audunru/memory-usage

Log memory usage in Laravel
3,980
Install
composer require audunru/memory-usage
Latest Version:v5.1.1
PHP:^8.3
Laravel:13
Older releases:6 – 12
License:MIT
Last Updated:Oct 19, 2026
Links: GitHub  ·  Packagist
Maintainer: audunru

Log Laravel Memory usage

Build Status Coverage Status

Log amount of memory used during HTTP requests. The peak memory usage in megabytes will be logged right before the response is returned.

The memory limit is configurable per request path. If you set the limit to 25 MiB for all requests, you will see something like this in your logs:

[2022-01-16 10:49:17] local.WARNING: Maximum memory 50.68 MiB used during request for /api/v1/companies/1/products is greater than limit of 25.00 MiB
[2022-01-16 10:49:29] local.WARNING: Maximum memory 50.39 MiB used during request for /api/v1/companies/1 is greater than limit of 25.00 MiB
[2022-01-16 10:49:29] local.WARNING: Maximum memory 60.04 MiB used during request for /api/v1/companies/1/sales is greater than limit of 25.00 MiB

Since v0.3.0 you can also log slow responses. If you set the limit to 3 seconds, you you will see something like this in your logs:

[2022-01-16 10:49:17] local.WARNING: Response time 5.15 s for /api/v1/companies/1/products is greater than limit of 3.00 s

Installation

Step 1: Install with Composer

composer require audunru/memory-usage

Configuration

Publish the configuration file by running:

php artisan vendor:publish --tag=memory-usage-config

Please open up the configuration file for further instructions on how to configure logging.

Development

Testing

Run tests:

composer test

Related Packages

frostrain/laravel-console-debug

Show debug informations in console

20,882 2
asvae/laravel-api-tester

Api tester for Laravel Framework

136,155 355
codeat3/blade-memory-icons

A package to easily make use of "Memory Icons" in your Laravel Blade views.

4,280 0
maxtrunk/lumen-debugbar

PHP Debugbar integration for Lumen

4,151 3
50wd/dev

Laravel 5.1 wrapper for the Dev API.

28 0

Version History

Version Released PHP Laravel License
v5.1.1 ^8.3 ^13.0 MIT
v5.1.0 ^8.3 ^13.0 MIT
v5.0.0 ^8.3 ^13.0 MIT
v4.0.5 ^8.2 ^12.0 MIT
v4.0.4 ^8.2 ^12.0 MIT