3

Since Laravel 5.7, the majority of global Helper functions (specifically the ones related with "Arrays & Objects" and "Strings") are now based on Facades (using Illuminate\Support\Str and Illuminate\Support\Arr classes) instead of being defined as "normal" helper functions, as they were before 5.7 (see difference with previous Laravel 5.6 docs).

Does it really mean that we are not allowed to use them anymore directly within our Blade views? If we do, they have to be obviously prefixed with its full path in any case, resulting in a dirtier Blade views... Is not this change counter-productive?

EDIT:

  • Made some googling and found this article that confirms the situation.
  • Also, I have seen that in 5.8.17 it is planned to include Arr and Str aliases by default within config/app.php (link).

In the meanwhile, I proceed to register Arr and Str aliases in my config/app.php config file to avoid the full path issue.

Thanks

andcl
  • 3,342
  • 7
  • 33
  • 61
  • 3
    if someone is still interested, this is how you register them as aliases https://paulund.co.uk/upgrading-laravel-6-using-arr-and-str-in-blade-files – Eboubaker Oct 02 '20 at 19:38

0 Answers0