Skip to content

Abstract Class Phalcon\Application\AbstractApplication

Source on GitHub

| Namespace | Phalcon\Application | | Uses | Phalcon\Di\DiInterface, Phalcon\Di\Injectable, Phalcon\Events\EventsAwareInterface, Phalcon\Events\ManagerInterface | | Extends | Injectable | | Implements | EventsAwareInterface |

Base class for Phalcon\Cli\Console and Phalcon\Mvc\Application.

Properties

/**
 * @var DiInterface
 */
protected container;

/**
 * @var string
 */
protected defaultModule;

/**
 * @var null | ManagerInterface
 */
protected eventsManager;

/**
 * @var array
 */
protected modules;

Methods

public function __construct( DiInterface $container = null );
Phalcon\AbstractApplication constructor

public function getDefaultModule(): string;
Returns the default module name

public function getEventsManager(): ManagerInterface;
Returns the internal event manager

public function getModule( string $name ): array | object;
Gets the module definition registered in the application via module name

public function getModules(): array;
Return the modules registered in the application

public function registerModules( array $modules, bool $merge = bool ): AbstractApplication;
Register an array of modules present in the application

$this->registerModules(
    [
        "frontend" => [
            "className" => \Multiple\Frontend\Module::class,
            "path"      => "../apps/frontend/Module.php",
        ],
        "backend" => [
            "className" => \Multiple\Backend\Module::class,
            "path"      => "../apps/backend/Module.php",
        ],
    ]
);

public function setDefaultModule( string $defaultModule ): AbstractApplication;
Sets the module name to be used if the router doesn't return a valid module

public function setEventsManager( ManagerInterface $eventsManager ): void;
Sets the events manager

Class Phalcon\Application\Exception

Source on GitHub

| Namespace | Phalcon\Application | | Extends | \Phalcon\Exception |

Exceptions thrown in Phalcon\Application class will use this class