Web
extends BaseRouter
in package
implements
WebRouterInterface
Web Router Class
Table of Contents
Interfaces
Constants
- ROUTER_TYPE = 'web'
Properties
- $translators : array<string|int, mixed>
- $avoid_parameter_names : array<string|int, mixed>
- $container : ContainerInterface
- $dispatcher : Dispatcher
- $routes : array<string|int, mixed>
Methods
- __call() : mixed
- {@inheritdoc}
- __construct() : mixed
- class constructor
- addRoute() : self
- adds a route
- checkRoute() : bool
- checks a route
- containerCall() : mixed
- call method through container
- containerMake() : mixed
- create object through container
- getApp() : App
- gets app object
- getApplicationLogger() : Manager
- gets application_logger service
- getAppRouteInfo() : RouteInfo|null
- gets route info
- getAppWebsite() : Website|null
- gets current website
- getAssets() : Manager
- gets assets manager
- getBaseUrl() : string|null
- return base site url
- getCache() : Manager
- get cache manager
- getContainer() : ContainerInterface
- gets container object
- getCrudRouter() : Crud
- gets crud service
- getDb() : Database
- gets db object
- getDebugbar() : StandardDebugBar
- gets debugbar object
- getDispatcher() : Dispatcher
- gets dispatcher
- getEnv() : mixed
- gets env variable
- getEventManager() : SharedEventEmitter
- gets events manager service
- getGoogleAuthenticator() : PHPGangsta_GoogleAuthenticator
- gets google authenticator service
- getGuzzle() : Client
- gets guzzle service
- getHtmlRenderer() : HtmlPartsRenderer
- gets html renderer service
- getHttpVerbs() : array<string|int, string>
- defines http default verbs
- getIcons() : Icons
- gets icons service
- getImagine() : Imagine
- gets imagine service
- getLog() : Logger
- gets log object
- getMailer() : Mailer
- gets mailer service
- getPdo() : PDO
- gets PDO object
- getRedis() : Manager
- gets redis service
- getRequest() : Request
- gets current request object
- getRequestInfo() : RouteInfo
- returns a RouteInfo instance for current request
- getRewriteUrl() : string
- gets rewrite's object url
- getRoute() : array<string|int, mixed>|null
- gets a single route
- getRouters() : array<string|int, mixed>
- gets routers
- getRoutes() : array<string|int, mixed>
- gets routes
- getSchema() : Schema
- gets schema object
- getSearch() : Manager
- gets search service
- getSesMailer() : SesClient
- gets SES mailer service
- getSiteData() : SiteData
- gets site data service
- getSmtpMailer() : Swift_Mailer
- gets SMTP mailer service
- getTemplates() : Engine
- gets plates engine object
- getTranslator() : Translator
- gets translator
- getUrl() : string
- Returns url for given route
- getUtils() : Globals
- gets global utils service
- getWebhooksRouter() : Webhooks
- gets webhooks service
- getWebRouter() : Web
- gets routing service
- getZip() : Zip
- gets zip service
- isEnabled() : bool
- determines if router is available
- requestUrl() : string|bool
- executes an http request
- checkRewrites() : Rewrite|null
- gets Rewrite Object by uri
- checkRouteParameters() : bool
- checks route parameters
- checkRouteVerbs() : array<string|int, mixed>
- checks route http verbs
- getArrayFromCache() : array<string|int, mixed>
- gets array from cache
- getCachedControllers() : array<string|int, mixed>
- gets cached controllers
- getCachedRewrites() : array<string|int, mixed>
- gets cached routes
- getCacheKey() : string
- compose cache key
- getClassHttpVerbs() : array<string|int, mixed>
- gets Class applicable route http verbs
- getRouteByClass() : array<string|int, mixed>
- gets route by class
- getRouterName() : string
- gets Router name
- getService() : mixed
- gets registered service
- setArrayInCache() : self
- sets array in cache
- setCachedControllers() : self
- sets cached controllers
- setCachedRoutes() : $this
- sets cached routes
- insertRoute() : self
- adds a route
- insertRoutes() : self
- adds routes
Constants
ROUTER_TYPE
public
mixed
ROUTER_TYPE
= 'web'
Properties
$translators
public
static array<string|int, mixed>
$translators
= []
translators
$avoid_parameter_names
protected
array<string|int, mixed>
$avoid_parameter_names
= ['container', 'route_info', 'route_data']
reserved parameter names
$container
protected
ContainerInterface
$container
$dispatcher
protected
Dispatcher
$dispatcher
dispatcher
$routes
protected
array<string|int, mixed>
$routes
routes
Methods
__call()
{@inheritdoc}
public
__call(string $name, mixed $arguments) : mixed
Parameters
- $name : string
- $arguments : mixed
Tags
__construct()
class constructor
public
__construct(ContainerInterface $container) : mixed
Parameters
- $container : ContainerInterface
Tags
addRoute()
adds a route
public
addRoute(string $group, string $name, string $path, string $class[, string $method = self::CLASS_METHOD ][, array<string|int, string> $verbs = ['GET', 'POST'] ]) : self
Parameters
- $group : string
- $name : string
- $path : string
- $class : string
- $method : string = self::CLASS_METHOD
- $verbs : array<string|int, string> = ['GET', 'POST']
Return values
selfcheckRoute()
checks a route
public
checkRoute(string $route) : bool
Parameters
- $route : string
Tags
Return values
boolcontainerCall()
call method through container
public
containerCall(callable $callable[, array<string|int, mixed> $arguments = [] ]) : mixed
Parameters
- $callable : callable
- $arguments : array<string|int, mixed> = []
containerMake()
create object through container
public
containerMake(string $className[, array<string|int, mixed> $arguments = [] ]) : mixed
Parameters
- $className : string
- $arguments : array<string|int, mixed> = []
getApp()
gets app object
public
getApp() : App
Tags
Return values
AppgetApplicationLogger()
gets application_logger service
public
getApplicationLogger() : Manager
Tags
Return values
ManagergetAppRouteInfo()
gets route info
public
getAppRouteInfo() : RouteInfo|null
Return values
RouteInfo|nullgetAppWebsite()
gets current website
public
getAppWebsite() : Website|null
Return values
Website|nullgetAssets()
gets assets manager
public
getAssets() : Manager
Tags
Return values
ManagergetBaseUrl()
return base site url
public
getBaseUrl() : string|null
Tags
Return values
string|nullgetCache()
get cache manager
public
getCache() : Manager
Tags
Return values
ManagergetContainer()
gets container object
public
getContainer() : ContainerInterface
Return values
ContainerInterfacegetCrudRouter()
gets crud service
public
getCrudRouter() : Crud
Tags
Return values
CrudgetDb()
gets db object
public
getDb() : Database
Tags
Return values
DatabasegetDebugbar()
gets debugbar object
public
getDebugbar() : StandardDebugBar
Tags
Return values
StandardDebugBargetDispatcher()
gets dispatcher
public
getDispatcher() : Dispatcher
Return values
DispatchergetEnv()
gets env variable
public
getEnv(string $variable[, mixed $default = null ]) : mixed
Parameters
- $variable : string
- $default : mixed = null
Tags
getEventManager()
gets events manager service
public
getEventManager() : SharedEventEmitter
Tags
Return values
SharedEventEmittergetGoogleAuthenticator()
gets google authenticator service
public
getGoogleAuthenticator() : PHPGangsta_GoogleAuthenticator
Tags
Return values
PHPGangsta_GoogleAuthenticatorgetGuzzle()
gets guzzle service
public
getGuzzle() : Client
Tags
Return values
ClientgetHtmlRenderer()
gets html renderer service
public
getHtmlRenderer() : HtmlPartsRenderer
Tags
Return values
HtmlPartsRenderergetHttpVerbs()
defines http default verbs
public
getHttpVerbs() : array<string|int, string>
Return values
array<string|int, string>getIcons()
gets icons service
public
getIcons() : Icons
Tags
Return values
IconsgetImagine()
gets imagine service
public
getImagine() : Imagine
Tags
Return values
ImaginegetLog()
gets log object
public
getLog() : Logger
Tags
Return values
LoggergetMailer()
gets mailer service
public
getMailer() : Mailer
Tags
Return values
MailergetPdo()
gets PDO object
public
getPdo() : PDO
Tags
Return values
PDOgetRedis()
gets redis service
public
getRedis() : Manager
Tags
Return values
ManagergetRequest()
gets current request object
public
getRequest() : Request
Tags
Return values
RequestgetRequestInfo()
returns a RouteInfo instance for current request
public
getRequestInfo([string|null $http_method = null ][, string|null $request_uri = null ][, string|null $domain = null ]) : RouteInfo
Parameters
- $http_method : string|null = null
- $request_uri : string|null = null
- $domain : string|null = null
Tags
Return values
RouteInfogetRewriteUrl()
gets rewrite's object url
public
getRewriteUrl(Rewrite $rewrite) : string
Parameters
- $rewrite : Rewrite
Tags
Return values
stringgetRoute()
gets a single route
public
getRoute(string $name) : array<string|int, mixed>|null
Parameters
- $name : string
Return values
array<string|int, mixed>|nullgetRouters()
gets routers
public
getRouters() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getRoutes()
gets routes
public
getRoutes() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getSchema()
gets schema object
public
getSchema() : Schema
Tags
Return values
SchemagetSearch()
gets search service
public
getSearch() : Manager
Tags
Return values
ManagergetSesMailer()
gets SES mailer service
public
getSesMailer() : SesClient
Tags
Return values
SesClientgetSiteData()
gets site data service
public
getSiteData() : SiteData
Tags
Return values
SiteDatagetSmtpMailer()
gets SMTP mailer service
public
getSmtpMailer() : Swift_Mailer
Tags
Return values
Swift_MailergetTemplates()
gets plates engine object
public
getTemplates() : Engine
Tags
Return values
EnginegetTranslator()
gets translator
public
getTranslator([string|null $locale_code = null ]) : Translator
Parameters
- $locale_code : string|null = null
Tags
Return values
TranslatorgetUrl()
Returns url for given route
public
getUrl(string $route_name[, array<string|int, mixed> $route_params = [] ]) : string
Parameters
- $route_name : string
- $route_params : array<string|int, mixed> = []
Tags
Return values
stringgetUtils()
gets global utils service
public
getUtils() : Globals
Tags
Return values
GlobalsgetWebhooksRouter()
gets webhooks service
public
getWebhooksRouter() : Webhooks
Tags
Return values
WebhooksgetWebRouter()
gets routing service
public
getWebRouter() : Web
Tags
Return values
WebgetZip()
gets zip service
public
getZip() : Zip
Tags
Return values
ZipisEnabled()
determines if router is available
public
static isEnabled() : bool
Return values
boolrequestUrl()
executes an http request
public
requestUrl(string $url[, string $method = 'GET' ][, array<string|int, mixed> $options = [] ]) : string|bool
Parameters
- $url : string
- $method : string = 'GET'
- $options : array<string|int, mixed> = []
Tags
Return values
string|boolcheckRewrites()
gets Rewrite Object by uri
protected
checkRewrites(string $uri) : Rewrite|null
Parameters
- $uri : string
Return values
Rewrite|nullcheckRouteParameters()
checks route parameters
protected
checkRouteParameters(string $route) : bool
Parameters
- $route : string
Return values
boolcheckRouteVerbs()
checks route http verbs
protected
checkRouteVerbs(array<string|int, mixed> $verbs) : array<string|int, mixed>
Parameters
- $verbs : array<string|int, mixed>
Return values
array<string|int, mixed>getArrayFromCache()
gets array from cache
protected
getArrayFromCache(mixed $array_name) : array<string|int, mixed>
Parameters
- $array_name : mixed
Tags
Return values
array<string|int, mixed>getCachedControllers()
gets cached controllers
protected
getCachedControllers() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getCachedRewrites()
gets cached routes
protected
getCachedRewrites() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getCacheKey()
compose cache key
protected
getCacheKey(string $element) : string
Parameters
- $element : string
Return values
stringgetClassHttpVerbs()
gets Class applicable route http verbs
protected
getClassHttpVerbs(mixed $controller_class) : array<string|int, mixed>
Parameters
- $controller_class : mixed
Tags
Return values
array<string|int, mixed>getRouteByClass()
gets route by class
protected
getRouteByClass(string $class[, string|null $uri = null ][, string|null $http_method = null ]) : array<string|int, mixed>
Parameters
- $class : string
- $uri : string|null = null
- $http_method : string|null = null
Return values
array<string|int, mixed>getRouterName()
gets Router name
protected
getRouterName() : string
Return values
stringgetService()
gets registered service
protected
getService(string $service_key) : mixed
Parameters
- $service_key : string
Tags
setArrayInCache()
sets array in cache
protected
setArrayInCache(mixed $array_name, mixed $array) : self
Parameters
- $array_name : mixed
- $array : mixed
Tags
Return values
selfsetCachedControllers()
sets cached controllers
protected
setCachedControllers(array<string|int, mixed> $controllers) : self
Parameters
- $controllers : array<string|int, mixed>
Tags
Return values
selfsetCachedRoutes()
sets cached routes
protected
setCachedRoutes(array<string|int, mixed> $routes) : $this
Parameters
- $routes : array<string|int, mixed>
Tags
Return values
$thisinsertRoute()
adds a route
private
insertRoute(RouteCollector $r, array<string|int, mixed> $p) : self
Parameters
- $r : RouteCollector
- $p : array<string|int, mixed>
Return values
selfinsertRoutes()
adds routes
private
insertRoutes(RouteCollector $r, array<string|int, mixed> $paths) : self
Parameters
- $r : RouteCollector
- $paths : array<string|int, mixed>