diff --git a/blade.md b/blade.md index 2cf02ae0201..a483b2abe89 100644 --- a/blade.md +++ b/blade.md @@ -658,6 +658,26 @@ If you have multiple classes within the same namespace, you may group the import @use('App\Models\{Flight, Airport}') ``` +The `@use` directive also supports importing PHP functions and constants by prefixing the import path with the `function` or `const` modifiers: + +```blade +@use(function App\Helpers\format_currency) +``` + +Just like class imports, aliases are supported for functions and constants as well: + +```blade +@use(function App\Helpers\format_currency, 'formatMoney') +@use(const App\Constants\MAX_ATTEMPTS, 'MAX_TRIES') +``` + +Grouped imports are also supported with both function and const modifiers, allowing you to import multiple symbols from the same namespace in a single directive: + +```blade +@use(function App\Helpers\{format_currency, format_date}) +@use(const App\Constants\{MAX_ATTEMPTS, DEFAULT_TIMEOUT}) +``` + ### Comments