“Call to undefined function str_slug()” in Laravel 10

Posted by

Error:

In cache.php line 91: Call to undefined function str_slug() Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1

Solution:

Since all of the auxiliary functions were eliminated in Laravel 10, this version of the software is incompatible with functions like str_limit, str_uuid, array_sort, and array_only.

You can install the package with the command if you still wish to use the helpful functions.

composer require laravel/helpers

Or you can do it using the Laravel facade.

use Illuminate\Support\Str;
 
$stringslug = Str::slug('My Custom String Here');
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x