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(Session::SUCCESS, 'User created successfully.');
H. info()
Description Generates output messages for console commands. A wrapper for the Session::info() function.
info("My message", Logger::INFO, Tools::BG_GREEN, Tools::TEXT_LIGHT_GREY);
I. logger()
Description: Writes a message to the log file with a specified level.
logger('User login failed', 'error');
J. now()
Description: Returns the current time formatted using application or user preferences.
now();
now('Europe/Berlin', 'H:i', 'de');
K. redirect()
Description: Redirects to a specified route.
redirect('login');
redirect('user.profile', [42]);
L. route()
Description: Generates a route URL from a dot-notated path and optional parameters.
route('user.profile', [42]);
M. vite()
Description: Returns the correct URL for a Vite-managed frontend asset.
vite('resources/js/app.js');