Core library for easily sharing commonly used classes and utilities across MixerAPI plugins.
composer require mixerapi/core
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.
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');