Documentation

Pop extends Application
in package

This is the main class for the Popcorn Micro-Framework.

Tags
category

Popcorn

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2023 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://popcorn.popphp.org/license New BSD License

version
3.4.0

Table of Contents

$config  : mixed
Application config
$autoloader  : mixed
Autoloader
$config  : mixed
Application config
$events  : Manager
Event manager
$modules  : Manager
Module manager
$router  : Router
Application router
$routes  : array<string|int, mixed>
Routes array
$services  : Locator
Service locator
__call()  : void
Magic method to check for a custom method
__construct()  : mixed
Constructor
__get()  : mixed
Get a pre-designated value from the application object
__isset()  : bool
Determine if a pre-designated value in the application object exists
__set()  : Application
Set a pre-designated value in the application object
__unset()  : Application
Unset a pre-designated value in the application object
addConfigValue()  : AbstractApplication
Add new value to config
addCustomMethod()  : Pop
Add a custom method
addRoute()  : Application
Add a route
addRoutes()  : Application
Add routes
addToAll()  : Pop
Add to all methods
any()  : Pop
Add to any and all methods (alias method to addToAll)
autoloader()  : mixed
Get the autoloader object
bootstrap()  : Application
Bootstrap the application, creating the required objects if they haven't been created yet and registering with the autoloader, adding routes, services and events
config()  : mixed
Access application config
connect()  : Pop
Add a CONNECT route
delete()  : Pop
Add a DELETE route
deleteConfigValue()  : AbstractApplication
Replace existing value in config
events()  : Manager
Get the event manager
get()  : Pop
Add a GET route
getRoute()  : mixed
Method to get a route by method
getRoutes()  : array<string|int, mixed>
Method to get all routes
getService()  : mixed
Get a service
hasCustomMethod()  : bool
Has a custom method
hasRoute()  : bool
Method to determine if the application has a route
head()  : Pop
Add a HEAD route
init()  : Application
Initialize the application
isAllowed()  : bool
Determine if the route is allowed on for the method
isRegistered()  : bool
Determine whether a module is registered with the application object
mergeConfig()  : AbstractApplication
Merge new or altered config values with the existing config values
module()  : ModuleInterface
Access a module object
modules()  : Manager
Access all application module configs
off()  : Application
Detach an event. Default hook-points are:
offsetExists()  : bool
Determine if a pre-designated value in the application object exists
offsetGet()  : mixed
Get a pre-designated value from the application object
offsetSet()  : Application
Set a pre-designated value in the application object
offsetUnset()  : Application
Unset a pre-designated value in the application object
on()  : Application
Attach an event. Default hook-points are:
options()  : Pop
Add an OPTIONS route
patch()  : Pop
Add a PATCH route
post()  : Pop
Add a POST route
put()  : Pop
Add a PUT route
register()  : Application
Register a module with the module manager object
registerAutoloader()  : Application
Register the autoloader object with the application
registerConfig()  : AbstractApplication
Register a new configuration with the application
registerEvents()  : Application
Register a new event manager object with the application
registerModules()  : Application
Register a new module manager object with the application
registerRouter()  : Application
Register a new router object with the application
registerServices()  : Application
Register a new service locator object with the application
removeService()  : Application
Remove a service
router()  : Router
Access the application router
run()  : void
Run the application.
services()  : Locator
Get the service locator
setRoute()  : Pop
Add a route
setRoutes()  : Pop
Add multiple routes
setService()  : Application
Set a service
trace()  : Pop
Add a TRACE route
trigger()  : Application
Trigger an event
unregister()  : Application
Unregister a module with the module manager object
updateConfigValue()  : AbstractApplication
Update existing value in config

Properties

$config

Application config

public mixed $config

mixed

$autoloader

Autoloader

protected mixed $autoloader = null

$routes

Routes array

protected array<string|int, mixed> $routes = ['get' => [], 'head' => [], 'post' => [], 'put' => [], 'delete' => [], 'trace' => [], 'options' => [], 'connect' => [], 'patch' => []]

Methods

__call()

Magic method to check for a custom method

public __call(string $methodName, array<string|int, mixed> $arguments) : void
Parameters
$methodName : string
$arguments : array<string|int, mixed>
Tags
throws
Exception
Return values
void

__construct()

Constructor

public __construct() : mixed

Instantiate an application object

Optional parameters are a service locator instance, a router instance, an event manager instance or a configuration object or array

Return values
mixed

__get()

Get a pre-designated value from the application object

public __get(string $name) : mixed
Parameters
$name : string
Return values
mixed

__isset()

Determine if a pre-designated value in the application object exists

public __isset(string $name) : bool
Parameters
$name : string
Return values
bool

__set()

Set a pre-designated value in the application object

public __set(string $name, mixed $value) : Application
Parameters
$name : string
$value : mixed
Tags
throws
Exception
Return values
Application

__unset()

Unset a pre-designated value in the application object

public __unset(string $name) : Application
Parameters
$name : string
Return values
Application

addCustomMethod()

Add a custom method

public addCustomMethod(string $customMethod) : Pop
Parameters
$customMethod : string
Return values
Pop

addRoute()

Add a route

public addRoute(string $route, mixed $controller) : Application
Parameters
$route : string
$controller : mixed
Return values
Application

addRoutes()

Add routes

public addRoutes(array<string|int, mixed> $routes) : Application
Parameters
$routes : array<string|int, mixed>
Return values
Application

addToAll()

Add to all methods

public addToAll(string $route, mixed $controller) : Pop
Parameters
$route : string
$controller : mixed
Return values
Pop

any()

Add to any and all methods (alias method to addToAll)

public any(string $route, mixed $controller) : Pop
Parameters
$route : string
$controller : mixed
Return values
Pop

autoloader()

Get the autoloader object

public autoloader() : mixed
Return values
mixed

bootstrap()

Bootstrap the application, creating the required objects if they haven't been created yet and registering with the autoloader, adding routes, services and events

public bootstrap([mixed $autoloader = null ]) : Application
Parameters
$autoloader : mixed = null
Tags
throws
Exception
throws
Exception
throws
Exception
Return values
Application

connect()

Add a CONNECT route

public connect(string $route, mixed $controller) : Pop
Parameters
$route : string
$controller : mixed
Return values
Pop

delete()

Add a DELETE route

public delete(string $route, mixed $controller) : Pop
Parameters
$route : string
$controller : mixed
Return values
Pop

get()

Add a GET route

public get(string $route, mixed $controller) : Pop
Parameters
$route : string
$controller : mixed
Return values
Pop

getRoute()

Method to get a route by method

public getRoute(string $method, string $route) : mixed
Parameters
$method : string
$route : string
Return values
mixed

getRoutes()

Method to get all routes

public getRoutes([string $method = null ]) : array<string|int, mixed>
Parameters
$method : string = null
Tags
throws
Exception
Return values
array<string|int, mixed>

getService()

Get a service

public getService(string $name) : mixed
Parameters
$name : string
Tags
throws
Exception
Return values
mixed

hasCustomMethod()

Has a custom method

public hasCustomMethod(string $customMethod) : bool
Parameters
$customMethod : string
Return values
bool

hasRoute()

Method to determine if the application has a route

public hasRoute(string $method, string $route) : bool
Parameters
$method : string
$route : string
Return values
bool

head()

Add a HEAD route

public head(string $route, mixed $controller) : Pop
Parameters
$route : string
$controller : mixed
Return values
Pop

isAllowed()

Determine if the route is allowed on for the method

public isAllowed(string $route) : bool
Parameters
$route : string
Return values
bool

isRegistered()

Determine whether a module is registered with the application object

public isRegistered(string $name) : bool
Parameters
$name : string
Return values
bool

off()

Detach an event. Default hook-points are:

public off(string $name, mixed $action) : Application

app.init app.route.pre app.dispatch.pre app.dispatch.post app.error

Parameters
$name : string
$action : mixed
Return values
Application

offsetExists()

Determine if a pre-designated value in the application object exists

public offsetExists(string $offset) : bool
Parameters
$offset : string
Return values
bool

offsetGet()

Get a pre-designated value from the application object

public offsetGet(string $offset) : mixed
Parameters
$offset : string
Return values
mixed

offsetSet()

Set a pre-designated value in the application object

public offsetSet(string $offset, mixed $value) : Application
Parameters
$offset : string
$value : mixed
Tags
throws
Exception
Return values
Application

offsetUnset()

Unset a pre-designated value in the application object

public offsetUnset(string $offset) : Application
Parameters
$offset : string
Return values
Application

on()

Attach an event. Default hook-points are:

public on(string $name, mixed $action, int $priority) : Application

app.init app.route.pre app.dispatch.pre app.dispatch.post app.error

Parameters
$name : string
$action : mixed
$priority : int
Return values
Application

options()

Add an OPTIONS route

public options(string $route, mixed $controller) : Pop
Parameters
$route : string
$controller : mixed
Return values
Pop

patch()

Add a PATCH route

public patch(string $route, mixed $controller) : Pop
Parameters
$route : string
$controller : mixed
Return values
Pop

post()

Add a POST route

public post(string $route, mixed $controller) : Pop
Parameters
$route : string
$controller : mixed
Return values
Pop

put()

Add a PUT route

public put(string $route, mixed $controller) : Pop
Parameters
$route : string
$controller : mixed
Return values
Pop

registerAutoloader()

Register the autoloader object with the application

public registerAutoloader(mixed $autoloader) : Application
Parameters
$autoloader : mixed
Tags
throws
Exception
Return values
Application

run()

Run the application.

public run([bool $exit = true ][, string $forceRoute = null ]) : void
Parameters
$exit : bool = true
$forceRoute : string = null
Tags
throws
Exception
Return values
void

setRoute()

Add a route

public setRoute(string $method, string $route, mixed $controller) : Pop
Parameters
$method : string
$route : string
$controller : mixed
Tags
throws
Exception
Return values
Pop

setRoutes()

Add multiple routes

public setRoutes(array<string|int, mixed>|string $methods, string $route, mixed $controller) : Pop
Parameters
$methods : array<string|int, mixed>|string
$route : string
$controller : mixed
Tags
throws
Exception
Return values
Pop

trace()

Add a TRACE route

public trace(string $route, mixed $controller) : Pop
Parameters
$route : string
$controller : mixed
Return values
Pop

trigger()

Trigger an event

public trigger(string $name[, array<string|int, mixed> $args = [] ]) : Application
Parameters
$name : string
$args : array<string|int, mixed> = []
Return values
Application

unregister()

Unregister a module with the module manager object

public unregister(string $name) : Application
Parameters
$name : string
Return values
Application

Search results