Global Helpers
Table of contents
1. Overview Table of Contents
This framework comes with a collection of global helpers to facilitate commonly performed tasks. Many are wrapper functions for those that are provided by various classes.
2. Globals Table of Contents
A. asset()
Description: Returns the full public URL for a given asset.
asset('images/logo.png');
// Outputs: http://yourdomain.com/images/logo.png
B. cl()
Description: Prints one or more variables to the browser console via JavaScript.
cl($user, $post);
C. config()
Description: Retrieves a configuration value using dot notation.
config('app.debug');
D. dd()
Description: Dumps variables using Symfony’s VarDumper and halts execution.
E. dump()
Description: Dumps variables using Symfony’s VarDumper without stopping execution.
dump($request);
F. e()
Description: Escapes a string for safe HTML output.
<h1>Welcome, <?= e($user['fname']) ?>!</h1>
G. flashMessage()
Description: Adds a flash message to the session.
flashMessage('success', 'User created successfully.');
H. logger()
Description: Writes a message to the log file with a specified level.
logger('User login failed', 'error');
I. now()
Description: Returns the current time formatted using application or user preferences.
now();
now('Europe/Berlin', 'H:i', 'de');
J. redirect()
Description: Redirects to a specified route.
redirect('login');
redirect('user.profile', [42]);
K. route()
Description: Generates a route URL from a dot-notated path and optional parameters.
route('user.profile', [42]);
L. vite()
Description: Returns the correct URL for a Vite-managed frontend asset.
vite('resources/js/app.js');
3. Forms Table of Contents
These helpers are wrappers around the Core\FormHelper class and are intended to simplify form building and validation handling in your views.
A. checkboxLabelLeft()
Description: Generates a checkbox input with the label placed to the left.
checkboxLabelLeft($label, $name, $value = '', $checked = false, $inputAttrs = [], $divAttrs = [], $errors = []);
B. checkboxLabelRight()
Description: Generates a checkbox input with the label placed to the right.
checkboxLabelRight($label, $name, $value = '', $checked = false, $inputAttrs = [], $divAttrs = [], $errors = []);
C. csrf()
Description: Renders a CSRF hidden input field.
csrf()
D. errorBag()
Description: Displays a list of form validation errors.
errorBag($errors);
E. email()
Description: Renders a labeled input of type email
.
email($label, $name, $value = '', $inputAttrs = [], $divAttrs = [], $errors = []);
F. hidden()
Description: Renders an input of type hidden
.
hidden($name, $value);
G. input()
Description: Generic input block for types other than submit. Use for text
, password
, number
, etc.
input($type, $label, $name, $value = '', $inputAttrs = [], $divAttrs = [], $errors = []);
H. output()
Description: Renders an <output>
HTML element.
output($name, $for);
I. radio()
Description: Renders an input of type radio
with label.
radio($label, $id, $name, $value, $checked = false, $inputAttrs = []);
J. select()
Description: Renders a <select>
dropdown with options.
select($label, $name, $value, $options, $inputAttrs = [], $divAttrs = [], $errors = []);
K. submitBlock()
Description: Renders a submit button inside a surrounding div.
submitBlock($buttonText, $inputAttrs = [], $divAttrs = []);
L. submit()
Description: Renders a standalone submit button.
submit($buttonText, $inputAttrs = []);
M. tel()
Description: Renders a labeled input of type tel
(telephone).
tel($label, $name, $value = '', $inputAttrs = [], $divAttrs = [], $errors = []);
N. textarea()
Description: Renders a <textarea>
block with label.
textarea($label, $name, $value = '', $inputAttrs = [], $divAttrs = [], $errors = []);