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

Spiral's avatar

Laravel: Error "Target class [request] does not exist" after cloning project and running composer install

I recently cloned a Laravel project from a Git repository that was previously worked on by another developer. After successfully running composer install, I encountered the following warning and error:

Package maximebf/debugbar is abandoned, you should avoid using it. Use php-debugbar/php-debugbar instead.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In Container.php line 879:
  Target class [request] does not exist.

In Container.php line 877:
  Class request does not exist.

I also get the same error when I try to run php artisan serve.

Steps I took:

  1. Cloned the repository

  2. Ran composer install (no other changes made)

  3. Tried php artisan serve, but the same "Class request does not exist" error appears

Composer.json

Is it possible that there's a misconfigured binding or the service container is trying to resolve a class alias that doesn’t exist? Any guidance would be really appreciated.

1 like
4 replies
Spiral's avatar

@vincent15000 Thanks for the suggestion.

I'm using:

PHP version: 8.1.2 Composer version: 2.7.2 Laravel version: 8.x (from composer.json)

Let me know if you think a specific version mismatch could be causing the issue. Also, do you know if this error could be related to missing or misconfigured bindings in a service provider or controller?

Happy to share more code if needed!

1 like
Spiral's avatar

@Glukinho Thanks for the suggestion.

I ran:

composer dump-autoload

It completed with:

Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In Container.php line 879:
  Target class [request] does not exist.

In Container.php line 877:
  Class request does not exist.

Generated optimized autoload files containing 30050 classes

So the autoload files are generated, but the same error still appears immediately during package:discover. Seems like Laravel is trying to resolve a [request] class or binding during this step and failing.

Could this be due to a missing binding or a misconfigured service provider?

1 like

Please or to participate in this conversation.