Skip to content

"pre-package-uninstall" script fails with service providers of non-installed packages #57613

@halloei

Description

@halloei

Laravel Version

12.36.1

PHP Version

8.3.27

Database Driver & Version

No response

Description

The pre-package-uninstall Composer event triggers Illuminate\Foundation\ComposerScripts::prePackageUninstall which boots the application. The boot fails if a service provider (in app/Providers/) is extending a service provider of a package which is not installed at the moment.

The error message:

Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 33 installs, 0 updates, 2 removals
> Illuminate\Foundation\ComposerScripts::prePackageUninstall

In AdminPanelProvider.php line 22:

[Error]
Class "Filament\PanelProvider" not found

Exception trace:
[...]

Steps To Reproduce

  1. Create branch-a from main and switch to it
  2. Add a Composer package that includes a service provider you should extend within your app:
    composer require filament/filament:"^4.0"
    php artisan filament:install --panels
    (This creates app/Providers/Filament/AdminPanelProvider.php which extends \Filament\PanelProvider and adds it to bootstrap/providers.php.)
  3. Create branch-b from main and switch to it
  4. Install any Composer package (e.g. composer r --dev barryvdh/laravel-debugbar)
  5. Switch to branch-a and run composer install

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions