MixerAPI Core libraries

v1.1.7 2023-01-08 15:11 UTC


Latest Version on Packagist Build Coverage Status MixerApi CakePHP Minimum PHP Version

Core library for easily sharing commonly used classes and utilities across MixerAPI plugins.


composer require mixerapi/core

Event Listener Loader

The Event Listener Loader will automatically load all listeners which implement Cake\Event\EventListenerInterface within a given namespace. Example:

# src/Application.php
use Cake\Http\BaseApplication;
use MixerApi\Core\Event\EventListenerLoader;

class Application extends BaseApplication
    public function bootstrap(): void
        // ...other code
        (new EventListenerLoader())->load();
        // other code...

The default behavior loads all listeners in App\Event. You can pass a different namespace argument as load($namespace) if your listeners are located elsewhere.

Namespace Utility

Returns one or more classes in a given namespace.

use MixerApi\Core\Utility\NamespaceUtility;

$controllers = NamespaceUtility::findClasses('\App\Controller');
$controller = NamespaceUtility::findClasses('\App\Controller', 'ActorsController');