Provider Class not found In ProviderRepository.php line 208

Provider Class not found In ProviderRepository.php line 208

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Provider Class not found In ProviderRepository.php line 208

When attempting to uninstall spatie/geocoder from a Laravel application, you might encounter a puzzling error indicating that a "Provider" class is missing within ProviderRepository.php at line 208. This specific failure usually points to a deeper issue than a simple package removal; it suggests that the application's service container has already instantiated or resolved this class during an earlier request cycle, creating a state mismatch that prevents clean uninstallation via standard Composer commands.

The error message typically manifests when running composer remove spatie/geocoder. While the command successfully pulls the update from GitHub and marks the package for removal in the lock file, the actual deletion fails because the class loader or autoloader detects that the referenced provider class is still expected to exist in the runtime environment. In many cases involving geocoding services, these providers are often bound to singleton instances or registered as aliases within the service container before the uninstall command completes.

The core technical conflict arises from how Laravel handles dependency resolution versus file system operations. When you run composer remove, Composer updates composer.json and composer.lock, but it does not automatically clear the application's memory or reset the service container bindings that occurred in previous requests. If your application has previously loaded a geocoder provider and stored an instance in the cache or registered it as a singleton, the removal process halts to prevent breaking existing runtime dependencies. This is a protective mechanism, albeit one that can be confusing if you are trying to perform a maintenance task outside of a fresh deployment environment.

To resolve this, you must ensure the service container and application state are cleared before attempting the removal. The most reliable approach is to flush the cache and restart the application server after removing the package from the composer.json file but before running the uninstall command in production. However, if you are working in a development environment, a more thorough reset involves clearing all caches explicitly:

php artisan config:clear
php artisan route:clear
php artisan cache:clear
php artisan view:clear

After ensuring the application state is clean, attempt the removal again:

composer remove spatie/geocoder

If the error persists despite clearing caches, inspect your app/Providers directory and any custom service provider files to ensure no lingering references to the spatie\Geocoder\Contracts\GeocoderProvider interface or its implementations remain. Sometimes, third-party packages register their own providers in the AppServiceProvider.php file. If you find such a registration, remove the use statement and the binding from that file as well.

It is also worth noting that if the package was installed via a custom autoload path or if there are leftover files in the vendor/spatie/geocoder directory that Composer failed to delete due to permissions or symlink issues, a manual cleanup might be necessary. Ensure that the vendor directory does not contain any stale symlinks pointing to removed packages.

In scenarios where you are migrating away from this package entirely, consider verifying that no external cron jobs or queue workers are still attempting to invoke the geocoding service. These background processes often maintain their own connection to the service container and can trigger the "Provider Class not found" error even after the main application has been restarted.

If the issue continues to block your workflow, reaching out for support from the Laravel community or visiting resources like https://laravelcompany.com can provide further guidance on managing complex dependency cycles in large-scale applications. The key takeaway is that Composer manages file system changes, but it does not manage runtime state; ensuring that state is reset is crucial when removing deeply integrated packages.

Our network