PHPackages                             drewlabs/laravel-mem-usage - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. drewlabs/laravel-mem-usage

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

drewlabs/laravel-mem-usage
==========================

Tracks per request memory usage in a Laravel application

v0.1.5(1y ago)077MITPHP

Since Aug 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/azlabsphp/laravel-mem-usage)[ Packagist](https://packagist.org/packages/drewlabs/laravel-mem-usage)[ RSS](/packages/drewlabs-laravel-mem-usage/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (5)Used By (0)

Documentation
=============

[](#documentation)

This library provides a middleware object that allows developpers to query for memory usage of laravel requests. The middleware can be registered globally making it to run on each request or attached to a specific route using middleware aliases.

By default it does nothing with the logged memory information. In order to write it to disk or to application database, developpers must provided event listeners that attached to `Drewlabs\Laravel\Memory\Usage\Log` class as follow:

```
// MyMemoryLogListener.php

class MyMemoryLogListener
{
    /**
     * Handle the event.
     */
    public function handle(\Drewlabs\Laravel\Memory\Usage\Log $log): void
    {
        // Note: returned value by each of these functions are of type AllocatedMemory{usedMemory, requestedMemory}
        $alloc1 = $log->getInitialMemoryAllocation(); // memory allocation before handling the request [memory consumed by laravel initialization classed and function ]
        $alloc2 = $log->getCurrentMemoryAllocation(); // $alloc2 = $alloc1 + memory consume by the actual request handler

        $diff = $log->getHandlersConsumedMemory(); // Compute the difference $diff = $alloc1 - $alloc 2

        // Do something with the logged information
    }
}

// Then we bind the event listener to the log event instance in our application service provider

// EventServiceProvider.php

use Illuminate\Foundation\Support\Providers\EventServiceProvider as BaseServiceProvider;

class EventServiceProvider extends BaseServiceProvider
{
	/**
	 * The event listener mappings for the application.
	 *
	 * @var array
	 */
	protected $listen = [
		\Drewlabs\Laravel\Memory\Usage\Log::class => [
			\App\Listeners\MyMemoryLogListener::class
		],
	];

	/**
	 * Register application services.
	 *
	 *
	 * @return void
	 */
	public function register()
	{
        // Call the event service provider instance
		parent::register();
    }
}
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

634d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/48c4973d500c7f4233d5ceacab51a57208d5fb60b0f95ae60264cf92380d0534?d=identicon)[azandrew-sidoine](/maintainers/azandrew-sidoine)

---

Top Contributors

[![azandrew-sidoine](https://avatars.githubusercontent.com/u/23530515?v=4)](https://github.com/azandrew-sidoine "azandrew-sidoine (5 commits)")

### Embed Badge

![Health badge](/badges/drewlabs-laravel-mem-usage/health.svg)

```
[![Health](https://phpackages.com/badges/drewlabs-laravel-mem-usage/health.svg)](https://phpackages.com/packages/drewlabs-laravel-mem-usage)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[beyondcode/laravel-server-timing

Add Server-Timing header information from within your Laravel apps.

5712.0M1](/packages/beyondcode-laravel-server-timing)[rollbar/rollbar-laravel

Rollbar error monitoring integration for Laravel projects

14110.4M7](/packages/rollbar-rollbar-laravel)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[kitloong/laravel-app-logger

Laravel log for your application

101.2M8](/packages/kitloong-laravel-app-logger)[label84/laravel-auth-log

Log user authentication actions in Laravel.

3654.0k](/packages/label84-laravel-auth-log)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
