texthtml/object-reaper

Be notified of objects being destroyed

dev-main 2024-11-21 21:39 UTC

This package is auto-updated.

Last update: 2024-11-21 21:39:03 UTC


README

Let you register callbacks that will be called when objects are destroyed.

Installation

composer req texthtml/object-reaper

Usage

$a = (object) [];

// Attach a callback to any object
// It will be called when the object is destroyed

Reaper::watch($a, function () { echo "Good Bye"; });

// "Good bye" will be printed when $a is destroyed