z_framework
in package
First class that is instantiated during a request.
Table of Contents
- $action_pattern_replacement : array<string|int, array<string|int, mixed>>
- $config : array<string|int, mixed>
- $config_file : string
- $maxReroutes : int
- $req : Request
- $reroutes : int
- $res : Response
- $routes : string
- $settings : array<string|int, mixed>
- $slimApplication : App
- $user : User
- $z_controllers : string
- $z_db : z_db
- $z_framework_root : string
- $z_models : string
- $z_views : string
- $modelCache : array<string|int, z_Model>
- __construct() : mixed
- Parses all the options as variables, instantiates the z_db, and establishes the db connection.
- __get() : mixed
- __set() : void
- execute() : mixed
- executeControllerAction() : mixed
- executePath() : mixed
- Executes an action for a specified path
- getModel() : z_model
- Returns a model
- getViewPath() : string
- Returns the path of a view. If the view does not exist, this function will fall back to the framework defaults.
- reroute() : void
- Tries to reroute the request using Slim first, if the route does not exist, it falls back to the ZubZet framework.
- updateErrorHandling() : mixed
- Updates the error handling state
- decodePost() : mixed
- Decodes all data sent via POST. Decoding method can be determined by the prefix of the value.
- handleRequest() : mixed
- Executes the requested action
- loadRoutes() : mixed
- parseUrl() : mixed
- Used to parse the URL into parts and parameters Format: root/class/method/parameter/parameter/.
- rest() : mixed
- Answers this request with a REST
Properties
$action_pattern_replacement
public
array<string|int, array<string|int, mixed>>
$action_pattern_replacement
= [["-", "_"], [".", "§2E"], ["ä", "ae"], ["ö", "oe"], ["ü", "ue"]]
Replacement patterns for action names
$config
public
array<string|int, mixed>
$config
= []
An associative array of key-value config parameters
$config_file
public
string
$config_file
= "z_config/z_settings.ini"
Path to the config file
$maxReroutes
public
int
$maxReroutes
= 10
Number of reroutes the controller can perform before aborting
$req
public
Request
$req
A reference to an instance of the Request class
$reroutes
public
int
$reroutes
= 0
Number of times this request was rerouted
$res
public
Response
$res
A reference to an instance of the Response class
$routes
public
string
$routes
= "app/Routes/"
Directory of the routes
$settings
public
array<string|int, mixed>
$settings
Stores the z_framework settings
$slimApplication
public
App
$slimApplication
The instance of the Slim application
$user
public
User
$user
The requesting user
$z_controllers
public
string
$z_controllers
= "app/Controllers/"
Directory in which the controllers live
$z_db
public
z_db
$z_db
Database proxy object
$z_framework_root
public
string
$z_framework_root
= __DIR__ . DIRECTORY_SEPARATOR
Directory where the framework files live
$z_models
public
string
$z_models
= "app/Models/"
Directory in which the models live
$z_views
public
string
$z_views
= "app/Views/"
Directory of the views
$modelCache
private
array<string|int, z_Model>
$modelCache
= []
Stores all already used models for this request
Methods
__construct()
Parses all the options as variables, instantiates the z_db, and establishes the db connection.
public
__construct([mixed $params = [] ]) : mixed
Parameters
- $params : mixed = []
Return values
mixed —__get()
public
__get(string $name) : mixed
Parameters
- $name : string
Return values
mixed —__set()
public
__set(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
Return values
void —execute()
public
execute([mixed $customUrlParts = null ]) : mixed
Parameters
- $customUrlParts : mixed = null
Return values
mixed —executeControllerAction()
public
executeControllerAction(mixed $controller, mixed $action[, array<string|int, mixed> $params = [] ]) : mixed
Parameters
- $controller : mixed
- $action : mixed
- $params : array<string|int, mixed> = []
Return values
mixed —executePath()
Executes an action for a specified path
public
executePath(array<string|int, mixed> $parts) : mixed
Parameters
- $parts : array<string|int, mixed>
-
Example: ["auth", "login"]
Return values
mixed —getModel()
Returns a model
public
getModel(string $model[, string $dir = null ]) : z_model
Parameters
- $model : string
-
Name of the model
- $dir : string = null
-
Set this when the model is stored in a specific directory
Return values
z_model —The model
getViewPath()
Returns the path of a view. If the view does not exist, this function will fall back to the framework defaults.
public
getViewPath(mixed ...$documents) : string
Parameters
- $documents : mixed
Return values
string —Relative path to the view file
reroute()
Tries to reroute the request using Slim first, if the route does not exist, it falls back to the ZubZet framework.
public
reroute(mixed $parts) : void
Parameters
- $parts : mixed
-
The parts of the new route. Example: ["auth", "login"]
Return values
void —updateErrorHandling()
Updates the error handling state
public
updateErrorHandling([int|null $state = null ]) : mixed
Parameters
- $state : int|null = null
Return values
mixed —decodePost()
Decodes all data sent via POST. Decoding method can be determined by the prefix of the value.
private
decodePost() : mixed
Return values
mixed —handleRequest()
Executes the requested action
private
handleRequest([array<string|int, mixed>|null $customUrlParts = null ]) : mixed
Parameters
- $customUrlParts : array<string|int, mixed>|null = null
-
Example: ["panel", "index"]
Return values
mixed —loadRoutes()
private
loadRoutes() : mixed
Return values
mixed —parseUrl()
Used to parse the URL into parts and parameters Format: root/class/method/parameter/parameter/.
private
parseUrl() : mixed
..
Return values
mixed —rest()
Answers this request with a REST
private
rest(mixed $options) : mixed
Parameters
- $options : mixed