There's no need to do anything unnecessary.
Even if you don't intend to use view, you may end up using it for Mail or Notifications.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi! I want to remove the entire frontend from the project and leave only the backend. In previous versions it was very easy to do this. And now there are problems.
I excepted this provider and removed it from app, routes, etc..
// config/app.php
'providers' => ServiceProvider::defaultProviders()
->except([
\Illuminate\View\ViewServiceProvider::class,
])
->merge([
\App\Providers\AppServiceProvider::class,
])
->toArray(),
But .. I still get message - Target class [view] does not exist. I don't understand how create default backend application on laravel 11 without any another frontend like nodejs, view, blade, etc... only what I need.
I didn't find any information how exclude it(
Override the web middleware group to not include the Illuminate\View\Middleware\ShareErrorsFromSession middleware. This middleware calls the View component to share the $errors global variable.
See this to learn how to do it:
https://laravel.com/docs/11.x/middleware#manually-managing-laravels-default-middleware-groups
You will also need to ask Laravel to always render exceptions as JSON, on your ./bootstrap/app.php
->withExceptions(function (Exceptions $exceptions) {
$exceptions->shouldRenderJsonWhen(static fn () => true);
})
As the default exception handler needs the View component.
Please or to participate in this conversation.