Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Destroy Laravel Package

internal/destroy

Explicit, deterministic resource cleanup for PHP via a Destroyable interface. Breaks circular reference chains and prevents memory leaks in long-running apps without relying on __destruct() or expensive gc_collect_cycles(). Ideal for daemons and event loops.

View on GitHub
Deep Wiki
Context7

Destroy

Support

The package provides explicit resource management for PHP applications through the Destroyable interface. It solves memory leaks in long-running applications by enabling deterministic cleanup of resources and breaking circular reference chains that prevent garbage collection.

Why Not Just __destruct()?

PHP's __destruct() method has critical limitations with circular references. While simple two-object cycles (A → B → A) can sometimes be resolved by gc_collect_cycles(), more complex scenarios with three or more interconnected objects often fail to trigger destructors at all.

Additionally, gc_collect_cycles() has significant performance overhead, making frequent calls impractical in high-performance applications.

// Simple cycle - might be collected eventually
$a->ref = $b;
$b->ref = $a;

// Complex cycle - often never collected
$a->ref = $b;
$b->ref = $c; 
$c->ref = $a;

The Destroyable interface provides explicit control over cleanup, ensuring resources are freed deterministically without relying on garbage collection cycles or performance-impacting manual collection calls.

Perfect for daemon processes, event-driven applications, and any scenario where deterministic resource cleanup is critical.

Installation

composer require internal/destroy

PHP Latest Version on Packagist License Total Destroys

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope