404labfr / 404labfr/laravel-impersonate

README: clarify provider registration on Laravel 11+ (manual config/app.php entry breaks Auth boot order)

Open
#239 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
2.3k
Forks
235
PR merge metrics
No merged PRs in 30d

Description

### Summary
On Laravel 11+, adding Lab404\Impersonate\ImpersonateServiceProvider to config/app.php's providers array (instead of relying on auto-discovery) breaks the app at boot:

`Target class [auth] does not exist.`

### Reproduction
Fresh Laravel 11+ (I'm on 13.4.0) project, no config/app.php providers key by default.
composer require lab404/laravel-impersonate.
Add to config/app.php:

```
'providers' => [
Lab404\Impersonate\ImpersonateServiceProvider::class,
],
```
Run any artisan command → Target class [auth] does not exist.

### Root cause
In Laravel 11+, `Illuminate\Foundation\Bootstrap\RegisterProviders::mergeAdditionalProviders()` uses the framework's default providers list only when config('app.providers') is null.

Adding a one-line `'providers' => [Lab404\Impersonate\ImpersonateServiceProvider::class]` to `config/app.php` replaces the default providers list, silently removing `Illuminate\Auth\AuthServiceProvider` from the boot sequence.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.