Laravel:更改Exception处理程序类的位置

We are restructuring the folder layout of our application so it aligns more with the DDD domain driver design idea.

e.g.

/app
   /Users
   /Jobs
   /Authentication
   /Http
   /Console
   /...
/bootstrap
/config
/...

Although one problem we are having is relocating the /Exceptions/Handler.php class. Our view would rename it to ExceptionHandler and place it in the root of the /app directory.

We get

PHP Fatal error: Uncaught ReflectionException: Class App\Exceptions\Handler does not exist ...

errors after relocating it.

Im assuming Laravel has a hard dependancy on that file being in that EXACT location, is that correct?

You also have to update it's binding in the service container. Example below is from Laravel 5.2 but I'm guessing it should be the same for all Laravel 5+.

// bootstrap/app.php
$app->singleton(
    Illuminate\Contracts\Debug\ExceptionHandler::class,
    App\Exceptions\Handler::class // Change this line with the new namespace
);