Skip to main content

Helpers

The engine includes a wide array of so-called helpers.

Helpers are functions that return class instances, values, and perform many other tasks.

To use a helper, simply call it by name. Helpers can be used anywhere:

footer();
navbar();
view();

// and others.

List of Standard Helpers

FunctionDescription
admin()Returns an instance of AdminService.
app($name = null)Returns an instance of the application class or resolves a class/interface from the container.
auth()Returns an instance of AuthService.
breadcrumb($key = null)Returns an instance of BreadcrumbService.
cache($key = null)Returns a cache instance or value by key.
chart()Returns an instance of FluteChart.
collect($elements = [])Returns an instance of the Collection collection.
config($key = null, $default = null)Returns configuration or value by key.
cookie($key = null, $default = null)Returns an instance of CookieService or cookie value by key.
dbal()Returns the DatabaseManager database manager.
db($connection = "default")Returns the current database instance.
orm()Returns an ORM instance.
ormdb($entity)Returns a database instance for ORM.
rep($entity)Returns a repository for an ORM entity.
transaction($entity, $operation = 'persist', $mode = Transaction::MODE_CASCADE)Initiates a transaction for an ORM entity.
debugbar()Returns an instance of FluteDebugBar.
debug($value)Adds messages to the MessagesCollector debugger.
email()Returns an instance of EmailService.
encrypt()Returns an instance of EncryptService.
events()Returns an instance of EventDispatcher event dispatcher.
fs()Returns an instance of FileSystemService.
finder()Returns an instance of Finder.
flash()Returns an instance of FlashService.
footer()Returns an instance of FooterService.
form($defaults = [])Returns an instance of FormService with default values set.
logs($name = "flute")Returns a Logger logger instance.
navbar()Returns an instance of NavbarService.
notification()Returns an instance of NotificationService.
page()Returns an instance of PageManager.
payments()Returns a GatewayInitializer instance for payment systems.
view($path, $data, $useTheme, $status, $headers)Displays a template with data and returns a Response object.
render($path, $data, $useTheme)Renders a template with data and returns it as a string.
response()Returns a SupportResponse instance.
request()Returns a FluteRequest instance.
json($data, $status, $headers, $json)Returns a JSON response with data.
redirect($to, $status, $headers)Returns a RedirectResponse object for redirection.
router()Returns a RouteDispatcher instance.
session($key, $default)Returns a SessionService instance or session value by key.
social()Returns a SocialService instance.
throttler()Returns a ThrottlerService instance.
table($ajaxPath, $section)Returns a TableBuilder instance.
template()Returns a Template instance.
__(key, $replacements, $locale)Returns a translation for the given key.
t(key, $replacements, $locale)Synonym for __(key, $replacements, $locale).
translation()Returns a Translator instance.
translation_service()Returns a LanguageService instance.
user()Returns a UserService instance.
tap($value, $callback)Executes a callback for a value and returns it.
url($path, $params)Generates a URL for the specified path.
is_url($value)Checks if a string is a valid URL.
path($path)Returns the full path to a file or folder.
public_path($path)Returns the full path to the public/ fulder
module_path($module, $path)Returns the full path to a module file.
tt($path)Returns the path to the theme.
is_installed()Checks if the application is installed.
is_debug()Checks if debug mode is enabled.
is_performance()Checks if performance mode is enabled.
abort_if($condition, $code, $message)Generates an exception if the
str_contains($haystack, $needle)Checks for the presence of a substring in a string.
getallheaders()Returns all HTTP request headers.
tip_active($key)Checks if a tip is active by key.
now()Returns the current DateTime object.
old($value, $default)Returns an old value from the session.
e($value)Escapes HTML characters in a string.
csrf_token()Returns a CSRF token.
table_lang()Returns the language tag for tables.
sq($ip, $port, $timeout, $engine)Uses SourceQuery to get server information.
widgets()Returns a WidgetManager instance.