Support Utilities
Helper utilities, sdílené support abstractions a doporučené usage patterns napříč aplikací.
Purpose
Support layer provides container-free helper functions and utility classes used by framework and application glue code. Services are accessed through dependency injection, controller helpers, $helpers or $requestHelpers.
Global helper bootstrap
Framework package autoloads src/Support/Helpers/bootstrap.php, which includes all helper files from Support/Helpers.
"autoload": {
"files": [
"src/Support/Helpers/bootstrap.php"
]
}
Service-backed view helpers
Service-backed view concerns are exposed through explicit view helper objects. Use $helpers for app-scoped concerns and $requestHelpers for current request/session state.
$detailUrl = $helpers->url('documentation.show', ['path' => 'core']);
$css = $helpers->asset('assets/app.css');
Environment and configuration helpers
Env utility resolves keys in order $_ENV -> $_SERVER -> getenv(). Typed methods: Env::string(), Env::int(), Env::float(), Env::bool(), Env::list(). env() remains a container-free helper. Configuration access in services should use injected Config.
$debug = Env::bool('APP_DEBUG', false);
$timeout = Env::float('HTTP_CLIENT_TIMEOUT', 10.0);
// APP_SUPPORTED_LOCALES=cs,en,de
$supportedLocales = Env::list('APP_SUPPORTED_LOCALES', ['cs']);
$baseUrl = $config->get('app.base_url', 'http://localhost');
URL, asset and path helpers
Views use $helpers->url(), $helpers->localizedUrl() and $helpers->asset(). Request-dependent URL state uses $requestHelpers->currentPath(), $requestHelpers->currentUrl(), $requestHelpers->currentFullUrl(), $requestHelpers->isUrlActive() and $requestHelpers->isRouteActive(). Application paths are provided by injected ApplicationContext.
$detailUrl = $helpers->url('documentation.show', ['path' => 'core']);
$css = $helpers->asset('assets/app.css');
$logs = $appContext->storagePath('writable/logs');
Localization helpers
Views use $helpers->lang(), $helpers->currentLocale(), $helpers->langGroup() and $helpers->langAll(). Services inject TranslatorInterface directly.
$title = $helpers->lang('homepage.title');
$locale = $helpers->currentLocale('en');
Form, CSRF and escaping helpers
CSRF view output uses $helpers->csrfField() and $helpers->csrfToken(). Request/session-dependent form state uses $requestHelpers->old() and $requestHelpers->flash(). Escaping helpers e, escape_html and escape_js remain container-free.
<?= $helpers->csrfField() ?>
<input name="email" value="<?= e((string) $requestHelpers->old('email', '')) ?>">
Formatting, date and string helpers
Formatting helpers include normalize_decimal_separator, human_weight, human_length, human_volume, human_filesize, php_size_to_mb. Date helpers include is_valid_date, to_date_immutable, from_date_immutable, days_between, days_diff_signed, days_until. String/text helpers include excerpt, trim_invisible_string, strip_invalid_xml, remove_emoji. Utility helpers include parse_textarea_list, normalize_url, apply_rounding, number_to_directory, is_valid_ean.
$size = human_filesize(1536);
$days = days_until('2026-12-31');
$text = remove_emoji('Hello 🚀');
Event, queue and logging helpers
Events, queue and logging are services, not global helper lookups. Inject the event dispatcher, queue bus or logger into application services, or compose them inside provider factories.
$events->dispatch(new UserRegisteredEvent($userId));
$queue->dispatch(new ReindexMessage($productId), 'database', 'default', 10);
$logger->error('Import failed');
Boundary
Only container-free helpers remain as global functions. Templates should use $helpers and $requestHelpers; application services should use constructor injection and service providers.