Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

iamamirsalehi's avatar

composer dump-autoload Generating optimized autoload files > Illuminate\Foundation\ComposerScripts::postAutoloadDump > @php artisan package:discover --ansi null Script @php artisan package:discover --ansi handling the post-autoload-dump event returned wit

Hi there.

Recently whenever I wanna update my composer or dump-autoload it, it gives me the blow error and I also can't the logged in user


$ composer dump-autoload
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
null
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1


0 likes
3 replies
Sinnbeck's avatar

Try running just the failing command, and see if there is an error

php artisan package:discover --ansi
2 likes
iamamirsalehi's avatar

@sinnbeck Thanks. this command solved the problem. but I can't get the logged in user with Auth::user and user() helper. What do you think the problem is?

Gifted's avatar

As stated above my error was this way

In Request.php line 334:

Symfony\Component\HttpFoundation\Request::create(): Argument #1 ($uri) must be of type string, null given, called in /home/rony/Downloads/Projects/Lar avel/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/ SetRequestForConsole.php on line 31

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

So executing this code shows exactly where your problem php artisan package:discover --ansi

Then my problem was in .env i had APP_URL=null instead of APP_URL=localhost

Thank you

Please or to participate in this conversation.