Index

Autoload

MMO\core\events · 1 symbol · generated 30 Sep 2026

class

Autoload

Autoload.php:15

Dispatched when an unknown class is referenced, giving listeners a chance to load/register it (a PSR-4-autoloader-style hook built on the event system instead of spl_autoload_register).

class MMO\core\events\Autoload extends MMO\core\events\Event implements MMO\core\interfaces\iStoppableEvent use MMO\core\classes\tStoppableEvent
Namespace
MMO\core\events
Extends
Event
Implements
iStoppableEvent
Uses traits
tStoppableEvent
Autoload::AddListener(function (Autoload $e) { $file = __DIR__ . '/' . str_replace('\\', '/', $e->class) . '.php'; if (file_exists($file)) {require $file;} });

Index

class readonly
stopped
isPropagationStopped()
OnNamespace($namespace, $handler, $order) staticRegister a listener that only fires for classes under $namespace.
stopPropagation()Prevent any remaining listener in the current dispatch chain from being called.
__clone()A cloned event starts fresh: propagation is never considered stopped on the clone, even if it was on the original instance.
__construct($origin, $class)

Properties2

class

readonly
readonly string $class
Type
string

stopped

protected $stopped = false

Methods5

OnNamespace($namespace, $handler, $order)

staticAutoload.php:37

Register a listener that only fires for classes under $namespace.

static function OnNamespace(string $namespace, callable $handler, int $order = 0): callable
$namespacestringe.g. 'My\Package' (a trailing '\' is added automatically if missing)
$handlercallablefunction(Autoload $event): void
$order = 0int
returnscallablethe actual (wrapping) listener registered -- pass this to tEvent::RemoveListener to unregister
Autoload::OnNamespace('My\\Package', fn($e) => require "src/{$e->class}.php");

stopPropagation()

tStoppableEvent.php:29

Prevent any remaining listener in the current dispatch chain from being called.

function stopPropagation()
returns

__clone()

tStoppableEvent.php:38

A cloned event starts fresh: propagation is never considered stopped on the clone, even if it was on the original instance.

function __clone()
returns

__construct($origin, $class)

Autoload.php:24
function __construct(object|string $origin, string $class)
$originobject | string
$classstringthe fully-qualified class name being autoloaded
Inherited members (12)
PropertiesDeclared byDescription
ListenersEvent
originEvent
MethodsDeclared byDescription
AddListener($handler, $order)EventRegister a listener directly (as opposed to ConnectListeners's attribute-based discovery).
ConnectListeners($obj)EventScan $obj's methods for #[Listen(EventClass::class)] attributes and register each one as a listener on the matching event class.
DisconnectListeners($obj)EventUndo a previous ConnectListeners: removes every listener that connect had registered for $obj on this event class.
dispatch()EventInvoke every GetListeners listener with $this.
GetListeners()EventCollect every listener for this class, including those registered on its parent classes (so a subclass event is also caught by listeners of its parent event), sorted by ascending $order (ties keep …
getOrigin()Event
HasListener($handler)Event
RemoveListener($handler)EventRemove the last added handler from the listeners.
Send($args)EventConstruct a new instance of this class with $args, then dispatch it to every listener.
SetListenerOrder($handler, $order)EventChange the order of an already-registered listener, whether added directly via AddListener or indirectly via ConnectListeners (which also stores its [$obj, $methodName] callables here).