Server
in package
Server Instance for handling multi tenancy
PHP Mini Framework
Tags
Table of Contents
- $domainApps : array<string|int, App>
- $domainPaths : array<string|int, string>
- $routeApps : array<string|int, App>
- $routePaths : array<string|int, string>
- addDomainApp() : self
- Map domain to a particular app. (Not recommended for production)
- addDomainPath() : self
- Map domain to a particular app path
- addDomainPathList() : self
- Map list of domain to a particular app path
- addRouteApp() : self
- Map route to a particular app. (Not recommended for production)
- addRoutePath() : self
- Map route to a particular app path
- addRoutePathList() : self
- Map list of route to a particular app path
- run() : ResponseInterface|bool
- Run server
- runDomain() : ResponseInterface|false|null
- Run for domain
- runRoute() : ResponseInterface|bool|null
- Run for route
Properties
$domainApps
private
array<string|int, App>
$domainApps
= []
Tags
$domainPaths
private
array<string|int, string>
$domainPaths
= []
Tags
$routeApps
private
array<string|int, App>
$routeApps
= []
Tags
$routePaths
private
array<string|int, string>
$routePaths
= []
Tags
Methods
addDomainApp()
Map domain to a particular app. (Not recommended for production)
public
addDomainApp(string $domain, App $app) : self
Parameters
- $domain : string
-
Domain name. e.g myap.com, dev.myapp.com
- $app : App
Tags
Return values
self —addDomainPath()
Map domain to a particular app path
public
addDomainPath(string $domain, string $path) : self
Parameters
- $domain : string
-
Domain name. e.g myap.com, dev.myapp.com
- $path : string
-
Path to app index. e.g ../myapp/public/index.php or ../myapp/public. If path is a directory, '/index.php' will be appended to the path
Tags
Return values
self —addDomainPathList()
Map list of domain to a particular app path
public
addDomainPathList(array<string|int, mixed> $list) : self
Parameters
- $list : array<string|int, mixed>
-
Array of
$domain => $path. seeself::addDomainPath
Tags
Return values
self —addRouteApp()
Map route to a particular app. (Not recommended for production)
public
addRouteApp(string $route, App $app) : self
Parameters
- $route : string
-
Route path to app. e.g v1
- $app : App
Tags
Return values
self —addRoutePath()
Map route to a particular app path
public
addRoutePath(string $route, string $path) : self
Parameters
- $route : string
-
Route path to app. e.g v1
- $path : string
-
Path to app index. e.g ../myapp/public/index.php or ../myapp/public. If path is a directory, '/index.php' will be appended to the path
Tags
Return values
self —addRoutePathList()
Map list of route to a particular app path
public
addRoutePathList(array<string|int, mixed> $list) : self
Parameters
- $list : array<string|int, mixed>
-
Array of
$route => $path. seeself::addRoutePath
Tags
Return values
self —run()
Run server
public
run([ServerRequestInterface|null $psr = null ]) : ResponseInterface|bool
Parameters
- $psr : ServerRequestInterface|null = null
Tags
Return values
ResponseInterface|bool —True if successful. ResponseInterface if failed
runDomain()
Run for domain
protected
runDomain(RequestInterface $request) : ResponseInterface|false|null
Parameters
- $request : RequestInterface
Tags
Return values
ResponseInterface|false|null —False if failed
runRoute()
Run for route
protected
runRoute(RequestInterface $request) : ResponseInterface|bool|null
Parameters
- $request : RequestInterface
Tags
Return values
ResponseInterface|bool|null —False if failed