AddonInterface.php

<?php

namespace Lia;

interface AddonInterface {

    /** 
     * Called when the addon is enabled by an app.
     *
     * Called after an App's Ready event.
     *
     * @example Your app's config.json declares `'addons':{ 'lia:router': 'public'}` to tell the router to setup routes for files in your app's 'public' dir. 
     * @note `$value`'s type is determined by the addon that is being enabled.
     *
     * @param $app the app that has enable this addon
     * @param $value the value stored in the config that marked this addon as enabled for the app. 
     */
    public function onEnabledByApp(\Lia\AppInterface $app, mixed $value);

    /** 
     * Setup the addon if it's global, or it's functionality is not tied to individual apps enabling it.
     *
     * Called after all addons are constructed and added to the app. May be called multiple times with different $addons arrays.
     *
     * @param $app The app this addon is in
     * @param $addons array<int index, \Lia\AddonInterface addon> array of addons that were just loaded.
     */
    public function onAddonsLoaded(\Lia\AppInterface $app, array $addons);


    /** Get short name */
    public function getName(): string;

    /** Get Fully Qualified Name */
    public function getFqn(): string;

}