image icon indicating copy to clipboard operation
image copied to clipboard

Laravel 5. Call to undefined method [package].

Open easmith opened this issue 11 years ago • 4 comments

After composer update I have exception:

user@host: /path/to/project$ php artisan clear-compiled
exception 'BadMethodCallException' with message 'Call to undefined method [package]' in /path/to/project/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php:111
Stack trace:
#0 /path/to/project/vendor/intervention/image/src/Intervention/Image/ImageServiceProvider.php(24): Illuminate\Support\ServiceProvider->__call('package', Array)
#1 /path/to/project/vendor/intervention/image/src/Intervention/Image/ImageServiceProvider.php(24): Intervention\Image\ImageServiceProvider->package('intervention/im...')
#2 [internal function]: Intervention\Image\ImageServiceProvider->boot()
#3 /path/to/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(535): call_user_func_array(Array, Array)
#4 /path/to/project/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(587): Illuminate\Container\Container->call(Array)
#5 /path/to/project/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(569): Illuminate\Foundation\Application->bootProvider(Object(Intervention\Image\ImageServiceProvider))
#6 [internal function]: Illuminate\Foundation\Application->Illuminate\Foundation\{closure}(Object(Intervention\Image\ImageServiceProvider), 35)
#7 /path/to/project/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(570): array_walk(Array, Object(Closure))
#8 /path/to/project/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(15): Illuminate\Foundation\Application->boot()
#9 /path/to/project/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(141): Illuminate\Foundation\Bootstrap\BootProviders->bootstrap(Object(Illuminate\Foundation\Application))
#10 /path/to/project/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(174): Illuminate\Foundation\Application->bootstrapWith(Array)
#11 /path/to/project/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(88): Illuminate\Foundation\Console\Kernel->bootstrap()
#12 /path/to/project/artisan(34): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 {main}
class ImageServiceProvider extends ServiceProvider
{
    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = false;

    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
       $this->package('intervention/image');

        // try to create imagecache route only if imagecache is present
        if (class_exists('Intervention\\Image\\ImageCache')) {

easmith avatar Dec 06 '14 15:12 easmith

This issue is not specific to Intervention\Image. Currently most packages brought into L5 are throwing this exact same error. Looks like something has changed in how these communicate with L5.

jmfleming avatar Dec 11 '14 20:12 jmfleming

The ServiceProvider architecture changed in Laravel 5.

I will not do anything Laravel 5 related until I know it is kinda final.

olivervogel avatar Dec 12 '14 18:12 olivervogel

Please read https://github.com/Intervention/image/issues/307

olivervogel avatar Jan 14 '15 16:01 olivervogel

Hey guys,

I've got an interim work around - https://github.com/morrislaptop/LaravelFivePackageBridges

Cheers, Craig

morrislaptop avatar Jan 22 '15 18:01 morrislaptop