Upgrade from Laravel 5.7 to 5.8

Asked

Viewed 50 times

-1

Good morning dear friends,

I am making the migration of my personal project from Laravel 5.7 to 5.8, but there is a part in the documentation that I didn’t understand very well, it may be a silly question, but I can’t find anything about it.

All array_* and str_* global helpers have been deprecated. You should use the Illuminate Support Arr and Illuminate Support Str methods directly.

What does that impact on my project? From what I understand the helpers of type array_* should be replaced by Arr, so where I have for example array_push I must replace it with Illuminate\Support\Arr::prepend in this case?

If anyone could clear me of this doubt I’d appreciate!

  • I do not understand some negative votes on questions, this seems to me legitimate and within the scope.

1 answer

2


There is no point in replacing native PHP functions with Laravel functions, the message refers to the global Laravel functions, it has nothing to do with array_push or str_replace, which are native.

Laravel functions (not native to PHP) were documented until version 5.6: https://laravel.com/docs/5.6/helpers, simply see what is documented in Laravel 5.8 for helpers and see what functions are available: https://laravel.com/docs/5.8/helpers

Some of the functions discontinued:

  • array_add
  • array_collapse
  • array_divide
  • array_dot
  • array_except
  • array_first
  • array_flatten
  • array_forget
  • array_get
  • arrays
  • array_last
  • array_only
  • array_pluck
  • array_prepend
  • array_pull
  • array_random
  • array_set
  • array_sort
  • array_sort_recursive
  • array_where
  • array_wrap
  • str_after
  • str_before
  • str_contains
  • str_finish
  • str_is
  • str_limit
  • str_plural
  • str_random
  • str_replace_array
  • str_replace_first
  • str_replace_last
  • str_singular
  • str_slug
  • str_start

Note that none has to do with PHP natives

  • Thanks, lately I haven’t programmed much in php, in my work I use VB and C#, and in the previous job I used typescript, so I was a little rusty, Thanks for the clarification!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.