BASE_PATH
App base path.
public
string
BASE_PATH
= dirname(__DIR__)
App base path.
public
string
BASE_PATH
= dirname(__DIR__)
App start time.
public
float
START_TIME
= microtime( rue)
Requires a directory recursively.
require_recursive(string $directory) : bool
If something was included, it returns true, otherwise false.
Aliases classes in a directory to the root namespace recursively. Note that namespaces have to follow PSR-4.
class_alias_recursive(string $directory, string $namespacePrefix) : bool
The path to a directory. If the passed parameter is not a directory, this function will skip it.
The prefix for classes namespace.
If something was aliased, it returns true, otherwise false.
Returns an instance of the `App` class.
app() : App
Aborts the current request and sends a response with the specified HTTP status code, title, and message.
abort() : void
An HTML page will be rendered with the specified title and message.
If a view file for the error page is set using {global.errorPages.CODE}
,
it will be rendered instead of the normal page and passed the $code
, $title
, and $message
variables.
The title for the most common HTTP status codes (200
, 401
, 403
, 404
, 405
, 500
, 503
) is already configured.
Terminates (exits) the PHP script.
terminate() : void
This function is used instead of PHP exit
to allow for testing exit
without breaking the unit tests.
This function never returns. It will terminate the script.
Gets or sets a value of a key from the configuration via dot-notation (0 param -> the `Config` class instance, 1 param -> get by key, 2 params -> set by key).
config() : mixed|Config
The requested value or null or the Config
object if no parameters are given.
Returns an instance of the `Event` class.
event() : Event
Returns an instance of the `Router` class.
router() : Router
Registers a handler for a route.
handle() : static
Redirects the request to another route.
redirect() : void
Note that this function will exit the script (code that comes after it will not be executed).
Forwards the request to another route.
forward() : void
Note that this function will exit the script (code that comes after it will not be executed).
Returns an instance of the `Globals` class.
globals() : Globals
Returns an instance of the `Session` class.
session() : Session
Returns an instance of the `Flash` class.
flash() : object
Returns an instance of the `CSRF` class.
csrf() : object
Returns an instance of the `Database` class.
database() : Database
Returns an instance of the `Auth` class.
auth() : Auth
Returns an instance of the `View` class.
view() : View
Renders a view (a Page wrapped in a Layout) with the passed variables, the Page content will be sent to `{view.defaultSectionName}` section.
render() : string
Renders a theme layout with the passed variables.
render_layout() : string
Renders a theme page with the passed variables.
render_page() : string
Renders a theme partial with the passed variables.
render_partial() : string
Pushes content to the buffer of the section with the given name.
section_push() : void
Note that a section will not be rendered unless it's yielded.
Resets (empties) the buffer of the section with the given name.
section_reset() : void
Ends capturing buffer of the section with the given name. Works in conjunction with `self::sectionStart()`.
section_start() : void
Note that a section will not be rendered unless it's yielded.
Ends capturing buffer of the section with the given name. Works in conjunction with `self::sectionStart()`.
section_end() : void
Note that a section will not be rendered unless it's yielded.
Returns content of the section with the given name.
section_yield() : string
Includes a file from the active theme directory.
include_file() : void
Can also be used as a mean of extending a layout if it was put at the end of it.
Returns an instance of the `Data` class.
data() : Data
Checks whether a value of a key exists in `self::$bag` via dot-notation.
data_has() : bool
Gets a value of a key from `self::$bag` via dot-notation.
data_get() : mixed
The requested value or null.
Sets a value of a key in `self::$bag` via dot-notation.
data_set() : void
Returns an instance of the `HTML` class.
html() : HTML
Returns an instance of the `Path` class.
path() : Path
Returns the current path, or compares it with the passed parameter. Note that the path does not contain the query string.
app_path_current() : string|bool
If null is passed, the current path as string. Otherwise the result of comparing the current path with the passed parameter as boolean.
Returns the current URL, or compares it with the passed parameter.
app_url_current() : string|bool
If null is passed, the current URL as string. Otherwise the result of comparing the current URL with the passed parameter as boolean.
Resolves the passed path to the app root path and returns it.
app_path() : string
An absolute path on the server starting from app root.
Resolves the passed path to the base URL (starting from app root) and returns it.
app_url() : string
An absolute path on the server (public URL) starting from app root.
Resolves the passed path to the theme root path and returns it.
theme_path() : string
A relative path starting from app root to the root of the active theme directory.
Resolves the passed path to the base URL (starting from active theme root) and returns it.
theme_url() : string
An absolute path on the server (public URL) starting from active theme root.
Resolves the passed path to the assets directory and returns it.
assets_path() : string
A relative path starting from app root to the root of the assets directory of the active theme directory.
Resolves the passed path to the base URL (starting from active theme assets root) and returns it.
assets_url() : string
An absolute path on the server (public URL) starting from active theme root.
Dumps a variable and dies.
dd(mixed ...$variable) : void
The result will simply get echoed.
Dumps a variable in a nice HTML block with syntax highlighting.
dump(mixed ...$variable) : void
The result will simply get echoed.
Dumps an exception in a nice HTML page or as string and exits the script.
dump_exception(Throwable $exception) : void
The result will be echoed as HTML page or a string representation of the exception if the interface is CLI.
Encodes the passed text with `htmlentities()`.
he(string $text) : string
Decodes the passed text with `html_entity_decode()`.
hd(string $text) : string
Encodes the passed text with `htmlspecialchars()`.
hse(string $text) : string
Decodes the passed text with `htmlspecialchars_decode()`.
hsd(string $text) : string
Strips the passed text with `strip_tags()`.
st(string $text) : string
Turns `\n` to `<br>` in the passed text with `nl2br()`.
nb(string $text) : string