Class ClassBased
ClassBased strategy will use the controller parameters extracted from URI and will attempt to include the respective class.
Optionaly apache's configuration via .htaccess can convert the url from:
/?controller={controller}&resource_id={resource_id}
to /{controller}/resource_id
and
/?controller={controller}
to /{controller}
RewriteEngine On
#Site full url with id
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z]{3,})/([a-zA-Z0-9_|%2520]+).*$ index.php?controller=$1&resource_id=$2 [L,QSA]
#Site full url
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z]{3,}).*$ index.php?controller=$1 [L,QSA]
- Phramework\URIStrategy\ClassBased implements Phramework\URIStrategy\IURIStrategy
Namespace: Phramework\URIStrategy
License: Apache-2.0
Author: Xenofon Spafaridis nohponex@gmail.com
Since: 1.0.0
Todo: document default_controller setting
Todo: Add documentation for setting default_controller
Located at URIStrategy/ClassBased.php
License: Apache-2.0
Author: Xenofon Spafaridis nohponex@gmail.com
Since: 1.0.0
Todo: document default_controller setting
Todo: Add documentation for setting default_controller
Located at URIStrategy/ClassBased.php
Methods summary
public
|
#
__construct( array $controllerWhitelist, array $controllerUnauthenticatedWhitelist, array $controllerPublicWhitelist, string $namespace = '', string $suffix = '' )
Initialize ClassBased IURIStrategy |
public
string[2]
|
#
invoke( object & $requestParameters, string $requestMethod, array $requestHeaders, object|false $requestUser )
Invoke URIStrategy |