Download the PHP package themattosdev/leakless without Composer
On this page you can find all versions of the php package themattosdev/leakless. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download themattosdev/leakless
More information about themattosdev/leakless
Files in themattosdev/leakless
Package leakless
Short Description Zero state and memory leak prevention for PHP persistent runtimes (FrankenPHP & Laravel Octane)
License MIT
Informations about the package leakless
Zero-State & Memory Leak Prevention for Persistent PHP Workers (FrankenPHP, RoadRunner, Swoole, Symfony, Laravel & Vanilla)
Overview
In traditional PHP-FPM, worker processes terminate after each request, allowing the OS to wipe memory and state. Persistent runtimes like FrankenPHP, RoadRunner, Swoole, and Laravel Octane keep PHP in memory across thousands of requests. While significantly faster, long-running workers can suffer from unmonitored C-extension memory growth (outside the Zend VM heap), dangling database transactions, open file handles, and polluted global/static state.
Leakless is an autonomous runtime guardian and static analysis engine for any persistent PHP stack: it reads real Linux kernel RSS from /proc/self/statm, rolls back uncommitted PDO transactions, cleans runtime state with a zero-reflection resettables engine in finally blocks, gracefully recycles workers before OOM Killer strikes, and provides static analysis via PHPStan and Pest assertions.
Installation
Usage
1. Vanilla PHP / FrankenPHP Loop
2. Laravel Octane (Zero-Config)
In config/leakless.php, you can also register classes or callbacks to auto-reset:
Note regarding Laravel Octane: Octane provides native
scoped()bindings and a'flush'list inconfig/octane.php. Leakless provides its compiled zero-reflectionresettablesengine and#[ResetOnRequest]attribute. It is at your own discretion which mechanism to use — you can rely on Octane's native mechanisms, use Leakless's resettables, or combine both seamlessly.
3. Declarative State Reset (#[ResetOnRequest])
Annotate properties or classes to automatically restore initial or default values between requests when registered in resettables:
Important:
#[ResetOnRequest]does not automatically scan all classes across your application. To be reset at runtime, the target class (forstaticstate) or object instance (for instance state) must be registered in'resettables'or via$leakless->registerResetTarget().
4. Automated Testing (Pest & PHPUnit)
5. Static Worker Linter CLI
Documentation
Full documentation, architecture guides, kernel memory details, and anti-pattern catalogues are available at:
👉 https://leakless.themattos.dev
Testing & Quality
License
Open-source software licensed under the MIT License.
Developed by Jonathan Gonçalves.