Documentation

Class Phalcon\Mvc\Application

extends abstract class Phalcon\Application

implements Phalcon\DI\InjectionAwareInterface, Phalcon\Events\EventsAwareInterface

Source on GitHub

This component encapsulates all the complex operations behind instantiating every component needed and integrating it with the rest to allow the MVC pattern to operate as desired.

<?php

 class Application extends \Phalcon\Mvc\Application
 {

    /\**
     * Register the services here to make them general or register
     * in the ModuleDefinition to make them module-specific
     */
    protected function _registerServices()
    {

    }

    /\**
     * This method registers all the modules in the application
     */
    public function main()
    {
            $this->registerModules(array(
                    'frontend' => array(
                            'className' => 'Multiple\Frontend\Module',
                            'path' => '../apps/frontend/Module.php'
                    ),
                    'backend' => array(
                            'className' => 'Multiple\Backend\Module',
                            'path' => '../apps/backend/Module.php'
                    )
            ));
    }
}

$application = new Application();
$application->main();

Methods

public __construct ([Phalcon\DI $dependencyInjector])

public Phalcon\Mvc\Application useImplicitView (boolean $implicitView)

By default. The view is implicitly buffering all the output You can full disable the view component using this method

public Phalcon\Http\ResponseInterface handle ([string $uri])

Handles a MVC request

public mixed request (unknown $uri)

Does a HMVC request in the application

public registerModules (array $modules, [boolean $merge]) inherited from Phalcon\Application

Register an array of modules present in the application

<?php

$this->registerModules(array(
    'frontend' => array(
            'className' => 'Multiple\Frontend\Module',
            'path' => '../apps/frontend/Module.php'
    ),
    'backend' => array(
            'className' => 'Multiple\Backend\Module',
            'path' => '../apps/backend/Module.php'
    )
));

public array getModules () inherited from Phalcon\Application

Return the modules registered in the application

public Phalcon\Application setDefaultModule (string $defaultModule) inherited from Phalcon\Application

Sets the module name to be used if the router doesn’t return a valid module

public string getDefaultModule () inherited from Phalcon\Application

Returns the default module name

public setDI (Phalcon\DIInterface $dependencyInjector) inherited from Phalcon\DI\Injectable

Sets the dependency injector

public Phalcon\DIInterface getDI ([unknown $error], [unknown $notUseDefault]) inherited from Phalcon\DI\Injectable

Returns the internal dependency injector

public setEventsManager (Phalcon\Events\ManagerInterface $eventsManager) inherited from Phalcon\DI\Injectable

Sets the event manager

public Phalcon\Events\ManagerInterface getEventsManager () inherited from Phalcon\DI\Injectable

Returns the internal event manager

public boolean fireEvent (string $eventName, [unknown $data], [unknown $cancelable]) inherited from Phalcon\DI\Injectable

Fires an event, implicitly calls behaviors and listeners in the events manager are notified

public boolean fireEventCancel (string $eventName, [unknown $data], [unknown $cancelable]) inherited from Phalcon\DI\Injectable

Fires an event, implicitly calls behaviors and listeners in the events manager are notified This method stops if one of the callbacks/listeners returns boolean false

public boolean hasService (string $name) inherited from Phalcon\DI\Injectable

Check whether the DI contains a service by a name

public mixed getResolveService (string $name, [unknown $args], [unknown $noerror], [unknown $noshared]) inherited from Phalcon\DI\Injectable

Resolves the service based on its configuration

public __get (unknown $property) inherited from Phalcon\DI\Injectable

Magic method __get

public __sleep () inherited from Phalcon\DI\Injectable

...

public __debugInfo () inherited from Phalcon\DI\Injectable

...