If you want to upload, resize, crop, rotate, watermark, and add various image filters to images using image intervention in Laravel application. And that time you get some error, class ‘intervention image imageServiceProvider’ not found laravel, class ‘intervention image facades image’ not found laravel, use intervention\image\homepage\image;, class intervention image not found 10, 9, 8.
Intervention Image Class, Facades, ServiceProviders Not Found in Laravel
Steps to resolve or fix the error, class ‘intervention image imageServiceProvider’ not found laravel, class ‘intervention image facades image’ not found laravel, use intervention\image\homepage\image, class intervention image not found in laravel 10, 9, 8.
- Step 1: Add “intervention/image” to composer.json
- Step 2: Run Composer Install
- Step 3: Add Service Provider
- Step 4: Add Aliases
- Step 5: Resolve Class Not Found Error
Step 1: Add “intervention/image” to composer.json
Open your composer.json
file and locate the “require” section. Add the following line:
"require": { "laravel/framework": "10.16.0*", "intervention/image": "dev-master" },
Step 2: Run Composer Install
Open your command-line interface (CMD) and run the following command:
$ composer install
If you encounter the warning:
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
proceed with the following steps:
$ composer update $ composer install
Step 3: Add Service Provider
Open the config/app.php
file and find the $providers
array. Add the following line to register the Intervention Image service provider:
Intervention\Image\ImageServiceProvider::class
Step 4: Add Aliases
Still in the config/app.php
file, locate the $aliases
array. Add the following line to create an alias for the Intervention Image facade:
'Image' => Intervention\Image\Facades\Image::class
Step 5: Resolve Class Not Found Error
If you encounter the error “Class ‘Intervention\Image\ImageServiceProvider’ not found,” try running the following command:
$ composer update
Conclusion
That’s it, you have learned how to fix Intervention Image Class Facades Providers Not Found in Laravel.