Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5.2: Class 'Intervention\Image\ImageServiceProvider' not found

I am trying to integrate Intervention Image into my project. I have followed the guide, used a shitton of other tutorials and no matter what I do, I keep getting the same error:

Class 'Intervention\Image\ImageServiceProvider' not found

It is included in my composer.json:

{
    "require": {
        "laravel/envoy": "~1.0",
        "laravel/installer": "^1.3",
        "intervention/image": "^2.3"
    }
}

I have installed the php-gd thingy, I included

Intervention\Image\ImageServiceProvider::class

and

'Image' => Intervention\Image\Facades\Image::class

in my config\app.php, but I keep getting the annoying error message. Maybe it's worth mentioning that I am on a Linux Mint OS and that I am using the Homestead Virtual Machine. Yes, I included the thingies in the Homestead version of Composer, not on my main PC's composer. When using

PHP artisan --version

, it returns:

Laravel Framework version 5.2.43

I ran composer update on the Virtual Machine, didn't solve the problem. I tried removing the lines from app.php, running composer update, adding the lines again and running composer update, didn't work.

Does it matter where I have the inclusions in config\app.php? Right now, the alias is in the list and the provider is under Package Service Providers.

Here is the full error message:

Whoops, looks like something went wrong.

1/1
FatalThrowableError in ProviderRepository.php line 146:
Class 'Intervention\Image\ImageServiceProvider' not found
in ProviderRepository.php line 146
at ProviderRepository->createProvider('Intervention\Image\ImageServiceProvider') in ProviderRepository.php line 114
at ProviderRepository->compileManifest(array('Illuminate\Auth\AuthServiceProvider', 'Illuminate\Broadcasting\BroadcastServiceProvider', 'Illuminate\Bus\BusServiceProvider', 'Illuminate\Cache\CacheServiceProvider', 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', 'Illuminate\Cookie\CookieServiceProvider', 'Illuminate\Database\DatabaseServiceProvider', 'Illuminate\Encryption\EncryptionServiceProvider', 'Illuminate\Filesystem\FilesystemServiceProvider', 'Illuminate\Foundation\Providers\FoundationServiceProvider', 'Illuminate\Hashing\HashServiceProvider', 'Illuminate\Mail\MailServiceProvider', 'Illuminate\Pagination\PaginationServiceProvider', 'Illuminate\Pipeline\PipelineServiceProvider', 'Illuminate\Queue\QueueServiceProvider', 'Illuminate\Redis\RedisServiceProvider', 'Illuminate\Auth\Passwords\PasswordResetServiceProvider', 'Illuminate\Session\SessionServiceProvider', 'Illuminate\Translation\TranslationServiceProvider', 'Illuminate\Validation\ValidationServiceProvider', 'Illuminate\View\ViewServiceProvider', 'Intervention\Image\ImageServiceProvider', 'App\Providers\AppServiceProvider', 'App\Providers\AuthServiceProvider', 'App\Providers\EventServiceProvider', 'App\Providers\RouteServiceProvider')) in ProviderRepository.php line 60
at ProviderRepository->load(array('Illuminate\Auth\AuthServiceProvider', 'Illuminate\Broadcasting\BroadcastServiceProvider', 'Illuminate\Bus\BusServiceProvider', 'Illuminate\Cache\CacheServiceProvider', 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', 'Illuminate\Cookie\CookieServiceProvider', 'Illuminate\Database\DatabaseServiceProvider', 'Illuminate\Encryption\EncryptionServiceProvider', 'Illuminate\Filesystem\FilesystemServiceProvider', 'Illuminate\Foundation\Providers\FoundationServiceProvider', 'Illuminate\Hashing\HashServiceProvider', 'Illuminate\Mail\MailServiceProvider', 'Illuminate\Pagination\PaginationServiceProvider', 'Illuminate\Pipeline\PipelineServiceProvider', 'Illuminate\Queue\QueueServiceProvider', 'Illuminate\Redis\RedisServiceProvider', 'Illuminate\Auth\Passwords\PasswordResetServiceProvider', 'Illuminate\Session\SessionServiceProvider', 'Illuminate\Translation\TranslationServiceProvider', 'Illuminate\Validation\ValidationServiceProvider', 'Illuminate\View\ViewServiceProvider', 'Intervention\Image\ImageServiceProvider', 'App\Providers\AppServiceProvider', 'App\Providers\AuthServiceProvider', 'App\Providers\EventServiceProvider', 'App\Providers\RouteServiceProvider')) in Application.php line 530
at Application->registerConfiguredProviders() in RegisterProviders.php line 17
at RegisterProviders->bootstrap(object(Application)) in Application.php line 203
at Application->bootstrapWith(array('Illuminate\Foundation\Bootstrap\DetectEnvironment', 'Illuminate\Foundation\Bootstrap\LoadConfiguration', 'Illuminate\Foundation\Bootstrap\ConfigureLogging', 'Illuminate\Foundation\Bootstrap\HandleExceptions', 'Illuminate\Foundation\Bootstrap\RegisterFacades', 'Illuminate\Foundation\Bootstrap\RegisterProviders', 'Illuminate\Foundation\Bootstrap\BootProviders')) in Kernel.php line 232
at Kernel->bootstrap() in Kernel.php line 127
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99
at Kernel->handle(object(Request)) in index.php line 53
like image 699
Somentus Avatar asked Oct 29 '22 22:10

Somentus


1 Answers

I had the same issue, it turns out i wasn't running this command $ php composer.phar require intervention/image on the root of my project. I did ran it on the root of my project and everything was fine.

E.g Itses-MacBook-Pro:testproject bigtank$ composer require intervention/image

run it like this and it would work.

Cheers.

like image 135
user3366705 Avatar answered Nov 30 '22 23:11

user3366705