Helpers
Data manipulation and general-purpose utility methods.
Data Manipulation Helpers
inputIsEmpty / inputIsNotEmpty
Checks if the input is empty or not. Unlike PHP's empty(), the string '0' and
the number 0 count as not empty — a deliberate choice so a legitimate zero
value isn't treated as a missing answer.
if ($form->inputIsEmpty($value)) { // Handle empty input }
sanitizeRequest
Sanitizes the input to prevent XSS attacks.
$safeValue = $form->sanitizeRequest($userInput);
slug
Converts a string to a URL-friendly slug.
$urlSlug = $form->slug("Hello World!"); // Output: Hello_World
Utility Helpers
config
Retrieves a configuration value using dot notation.
$dateFormat = $form->config('dateFormat');
dd
Dumps a value and dies (stops execution).
$form->dd($variable);
dump
Dumps a value to the screen without stopping execution.
$form->dump($variable);
destroySession
Deletes the Flick session data.
$form->destroySession(); // Destroy silently, without the success alert $form->destroySession(false);
Parameters:
$message-bool(optional, defaulttrue) - Whentrue, prints a success alert into the page. Passfalseto destroy the session silently.
getIp
Returns the visitor's IP address.
$userIp = $form->getIp();
redirect
Redirects to a given URL after form submission.
// Standalone mode (default): exits after redirect $form->redirect('/success'); // Framework mode: returns the handler's result return $form->redirect('/success');
Parameters:
$url-string(optional) - The URL to redirect to. Defaults to current page if empty or'self'.
Returns:
mixed|null- Returnsnullif form not submitted or has errors. With customonRedirecthandler, returns the handler's result (e.g., a Laravel redirect response).
Behavior:
- Only redirects if
$form->submitted()and$form->ok()are both true - In standalone mode (default), outputs
Locationheader and callsexit() - With custom
onRedirecthandler, calls the handler and returns its result
See Framework Integration for customizing redirect behavior.
verifyPassword
Verifies a hashed (bcrypt) password.
if ($form->verifyPassword($inputPassword, $storedHash)) { // password is correct }
getFields
Returns an array of all form fields with their validation rules.
$fields = $form->getFields();
hasValidationRules
Checks if any form fields have validation rules defined.
if ($form->hasValidationRules()) { // Form has validation rules }