shipmonk/memory-scanner
ShipMonk's Memory Scanner is a lightweight PHP utility for measuring memory usage around callbacks and code blocks. It helps compare implementations, track allocations, and spot leaks or unexpected memory growth in tests and long-running processes, keeping memory consumption under control.
memory_get_usage() / memory_get_peak_usage() calls and Log::info() lines through jobs and controllers. Adopting it is a small, reversible buy decision; a PM can approve it as a dev-only dependency rather than sponsoring an internal tooling project.Allowed memory size exhausted, this gives engineers a structured way to attribute memory growth to a code path instead of guessing. That directly shortens MTTR on a recurring, high-visibility outage class.memory_limit to set, whether to chunk an export, whether a job must be released in batches. These are roadmap-adjacent infra decisions that are otherwise made on vibes.Consider it when most of these are true:
memory_limit raised repeatedly as a workaround.Look elsewhere when:
Pragmatic stance: approve for evaluation in a spike, not as a platform dependency. Success criteria are concrete — did it locate the leak, and did the fix hold under load?
To executives (one paragraph): Memory exhaustion is one of the most common causes of hard-to-reproduce 500s, stuck queue workers, and late-night pages in PHP systems, and it is usually diagnosed by guesswork. This is a free, MIT-licensed, development-only library that lets engineers pinpoint where memory is going instead of raising memory_limit again. Cost is effectively zero (no license, no infrastructure, no runtime footprint in production), the blast radius is small (dev dependency, removable in one line), and the payoff is faster resolution of a specific, recurring outage class plus better-informed worker sizing. The caveat is maturity: it has a small community, so I recommend a time-boxed pilot on one known problem rather than an org-wide standard, and I would not present it as a replacement for paid profiling or APM.
To engineering leads: Simple API, fits the existing Laravel/PHP toolchain, no service to operate, no production instrumentation required — run it locally or in CI against the reproduction. It complements rather than replaces Xdebug or an APM: use it for targeted leak hunts and as a possible memory budget assertion in tests. Risks to accept explicitly: small user base, so budget a short compatibility check on your PHP and Laravel versions, pin the version, and keep the usage behind a small internal wrapper so swapping it out later is cheap.
Framing to avoid: do not sell this as "observability" or "APM." It is a scalpel for a specific class of bug. The pitch is cheap, reversible, targeted risk reduction on memory-related incidents — not a platform investment.
How can I help you explore Laravel packages today?