Functions

getNamespaceFromPath

Convenience function for extracting a controller namespace from a path.

Usage:

use function Ascmvc\getNamespaceFromPath; // [...] $namespaceName = getNamespaceFromPath('/foo/bar/baz');

package

LightMVC/ASCMVC

Arguments

$path

string

$separator

string

Response

string

« More »

Classes, interfaces and traits

AscmvcBootstrapListenerInterface

AscmvcRenderListenerInterface allows the implementing class to be consumed as a AscmvcEventManager class listener.

The interface's methods correspond exactly to the application's events as they are used in its run() method so that, in turn, these methods may be dynamically called by the EventManager's event-driven "trigger" methods.

« More »

AscmvcControllerFactoryInterface

Interface AscmvcControllerFactoryInterface

FactoryInterface allows the implementing class to create itself using initialization logic.

« More »

AscmvcDispatchListenerInterface

AscmvcRenderListenerInterface allows the implementing class to be consumed as a AscmvcEventManager class listener.

The interface's methods correspond exactly to the application's events as they are used in its run() method so that, in turn, these methods may be dynamically called by the EventManager's event-driven "trigger" methods.

« More »

AscmvcEventManagerListenerInterface

EventManagerListenerInterface allows the implementing class to be consumed as a AscmvcEventManager class listener.

The interface's methods correspond exactly to the application's main events as they are defined in its run() method so that, in turn, these methods may be dynamically called by the EventManager's event-driven "trigger" methods.

« More »

AscmvcFinishListenerInterface

AscmvcFinishListenerInterface allows the implementing class to be consumed as a AscmvcEventManager class listener.

The interface's methods correspond exactly to the application's events as they are used in its run() method so that, in turn, these methods may be dynamically called by the EventManager's event-driven "trigger" methods.

« More »

AscmvcRenderListenerInterface

AscmvcRenderListenerInterface allows the implementing class to be consumed as a AscmvcEventManager class listener.

The interface's methods correspond exactly to the application's events as they are used in its run() method so that, in turn, these methods may be dynamically called by the EventManager's event-driven "trigger" methods.

« More »

AscmvcRouteListenerInterface

AscmvcRenderListenerInterface allows the implementing class to be consumed as a AscmvcEventManager class listener.

The interface's methods correspond exactly to the application's events as they are used in its run() method so that, in turn, these methods may be dynamically called by the EventManager's event-driven "trigger" methods.

« More »

AbstractApp

Class AbstractApp

The abstract AbstractApp class is the blueprint for the MVC's main engine.

« More »

AbstractController

The abstract AbstractController class is the blueprint for the MVC's controllers.

Description The AbstractController class is the one that needs to be extended in order to create a LightMVC controller.

« More »

AbstractControllerManager

The abstract AbstractControllerManager class is the blueprint for the MVC's ControllerManager.

The AbstractControllerManager class is the one that needs to be extended in order to create a LightMVC ControllerManager.

« More »

AbstractModelObject

Class AbstractModelObject

The abstract AbstractModelObject class is the blueprint for the MVC's main model objects.

Description The AbstractModelObject class is the one that needs to be extended in order to create a LightMVC model object.

« More »

AbstractRouter

The AbstractRouter class is the blueprint for the MVC's main router.

The AbstractRouter class is the one that needs to be extended in order to create a LightMVC router.

« More »

Classes, interfaces and traits

LazyLoadingMiddleware

Class LazyLoadingMiddleware

This class stores given middleware inside a Container factory in order to load them only when needed.

« More »

MiddlewareFactory

Class MiddlewareFactory

Marshal middleware for use in the application.

This class provides a number of methods for preparing and returning middleware for use within an application.

If any middleware provided is already a MiddlewareInterface, it can be used verbatim or decorated as-is. Other middleware types acceptable are:

  • PSR-15 RequestHandlerInterface instances; these will be decorated as RequestHandlerMiddleware instances.
  • string service names resolving to middleware
  • arrays of service names and/or MiddlewareInterface instances
  • PHP callables that follow the PSR-15 signature

Additionally, the class provides the following decorator/utility methods:

  • callableMiddleware() will decorate the callable middleware passed to it using CallableMiddlewareDecorator.
  • handlerMiddleware() will decorate the request handler passed to it using RequestHandlerMiddleware.
  • lazyMiddleware() will decorate the string service name passed to it, along with the factory instance, as a LazyLoadingMiddleware instance.
  • pipeline() will create a MiddlewarePipe instance from the array of middleware passed to it, after passing each first to prepare().
« More »

Classes, interfaces and traits

App

Class App

The abstract AbstractApp class is the blueprint for the MVC's main engine.

« More »

AscmvcEvent

Class AscmvcEvent

The clas AscmvcEvent extends the Zend\EventManager\Event class and adds logic that is specific to this MVC.

« More »

AscmvcEventManager

Class AscmvcEventManager

The AscmvcEventManager class extends the Zend\EventManager\EventManager class and adds events and logic that are specific to this MVC.

« More »

AscmvcEventManagerFactory

Class AscmvcEventManagerFactory

Returns an instance of the AscmvcEventManager without a shared manager.

« More »

Atlas

Class Atlas

The Atlas class extends the AbstractModelObject and uses the atlas/orm library.

« More »

Controller

Class Controller

The Controller class extends the AbstractController and implements the AscmvcEventManagerListenerInterface.

« More »

ControllerManager

Class ControllerManager

The ControllerManager class extends the AbstractControllerManager and acts as the MVC's dispatcher object.

« More »

Doctrine

Class Doctrine

The Doctrine class extends the AbstractModelObject and uses the doctrine/dbal and doctrine/orm libraries.

« More »

FastRouter

Class FastRouter

The FastRouter class extends the AbstractRouter class and uses the nikic/fast-route library.

« More »

Psr4Autoloader

An example of a general-purpose implementation that includes the optional functionality of allowing multiple base directories for a single namespace prefix.

Given a foo-bar package of classes in the file system at the following paths ...

/path/to/packages/foo-bar/
    src/
        Baz.php             # Foo\Bar\Baz
        Qux/
            Quux.php        # Foo\Bar\Qux\Quux
    tests/
        BazTest.php         # Foo\Bar\BazTest
        Qux/
            QuuxTest.php    # Foo\Bar\Qux\QuuxTest

... add the path to the class files for the \Foo\Bar\ namespace prefix as follows:

 <?php
 // instantiate the loader
 $loader = new \Example\Psr4AutoloaderClass;

 // register the autoloader
 $loader->register();

 // register the base directories for the namespace prefix
 $loader->addNamespace('Foo\Bar', '/path/to/packages/foo-bar/src');
 $loader->addNamespace('Foo\Bar', '/path/to/packages/foo-bar/tests');

The following line would cause the autoloader to attempt to load the \Foo\Bar\Qux\Quux class from /path/to/packages/foo-bar/src/Qux/Quux.php:

 <?php
 new \Foo\Bar\Qux\Quux;

The following line would cause the autoloader to attempt to load the \Foo\Bar\Qux\QuuxTest class from /path/to/packages/foo-bar/tests/Qux/QuuxTest.php:

 <?php
 new \Foo\Bar\Qux\QuuxTest;
« More »

ViewObjectFactory

Class ViewObjectFactory

The ViewObjectFactory creates an instance of the Plates, Twig or Smarty template manager, according to specified configuration.

« More »