Skip to content

LeaklessZero-State & Memory Leak Prevention

The autonomous runtime guardian and static analysis engine for persistent PHP workers (FrankenPHP & Laravel Octane).

Quick Installation

bash
composer require themattosdev/leakless
bash
composer require --dev themattosdev/leakless-dev

Worker Protection Example

ini
# Zero-Config: Leakless auto-discovers and attaches to Octane lifecycle events
LEAKLESS_MAX_RSS_MB=256
LEAKLESS_MAX_REQUESTS=1000
LEAKLESS_CHECK_TRANSACTIONS=true
LEAKLESS_ROLLBACK_STATE=true
LEAKLESS_LOG_VIOLATIONS=true
php
use TheMattos\Leakless\Config;
use TheMattos\Leakless\Integrations\FrankenPhp\FrankenPhp;

$config = new Config(
    maxRssMb: 256,
    maxRequests: 1000,
    checkTransactions: true,
);

FrankenPhp::run(function () {
    // Your application request handler
    echo json_encode(['status' => 'ok', 'timestamp' => time()]);
}, $config);
php
use App\Services\OrderProcessor;

test('order processor executes without memory drift or transaction leaks', function () {
    expect(OrderProcessor::class)->toBeLeakless();

    expect(function () {
        (new OrderProcessor())->handleBatch();
    })->toRunCleanly(maxDriftMb: 5.0);
});
bash
vendor/bin/leakless analyze

Released under the MIT License.