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

Posted by

Error:

Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.
Nothing to install, update or remove
Package fzaninotto/faker is abandoned, you should avoid using it. No replacement was suggested.
Generating optimized autoload files
Class App\Http\Controllers\PassportAPI\VenueController located in C:/xampp-new/htdocs/ds-company-10-ms/app\Http\Controllers\VenueController.php does not comply with psr-4 autoloading standard. Skipping.
Class App\Helpers\Helper located in C:/xampp-new/htdocs/ds-company-10-ms/app\Http\Helpers\Helpers.php does not comply with psr-4 autoloading standard. Skipping.
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
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:

f you have gone through the upgrade guide then you must know that

String and Array Helpers have been removed from the Core Framework

So if You need to use the helper install the package

composer require laravel/helpers

and all the helpers are moved to this package

after that run Composer install

Leave a Reply

Your email address will not be published. Required fields are marked *

0
Would love your thoughts, please comment.x
()
x