Skip to content

Phalcon application

NOTE

All classes are prefixed with Phalcon

Application\AbstractApplication

Abstract Source on GitHub

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

Uses Phalcon\Application\Exceptions\ModuleNotRegistered · Phalcon\Di\DiInterface · Phalcon\Di\Injectable · Phalcon\Events\EventsAwareInterface · Phalcon\Events\ManagerInterface

Method Summary

Properties

protected DiInterface|null $container = null
protected string $defaultModule = ""
protected ManagerInterface|null $eventsManager = null
protected array $modules = []

Methods

Public · 8

__construct()

public function __construct( DiInterface $container = null );

Phalcon\AbstractApplication constructor

getDefaultModule()

public function getDefaultModule(): string;

Returns the default module name

getEventsManager()

public function getEventsManager(): ManagerInterface|null;

Returns the internal event manager

getModule()

public function getModule( string $name ): array|object;

Gets the module definition registered in the application via module name

getModules()

public function getModules(): array;

Return the modules registered in the application

registerModules()

public function registerModules(
    array $modules,
    bool $merge = false
): static;

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",
        ],
    ]
);

setDefaultModule()

public function setDefaultModule( string $defaultModule ): static;

Sets the module name to be used if the router does not return a valid module

setEventsManager()

public function setEventsManager( ManagerInterface $eventsManager ): void;

Sets the events manager

Application\Exception

Class Source on GitHub

Exceptions thrown in Phalcon\Application class will use this class

Application\Exceptions\ModuleNotRegistered

Class Source on GitHub

This file is part of the Phalcon Framework.

(c) Phalcon Team team@phalcon.io

For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.

Uses Phalcon\Application\Exception

Method Summary

Methods

Public · 1

__construct()

public function __construct( string $name );