Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

imJohnBon's avatar

[L5] Dec 4th commit: Call to undefined method Illuminate\Config\Repository::package()

Not really a question I suppose, really just throwing it out there. The latest Laravel 5 commit tonight seems to be breaking my build. I managed to narrow it down, it only happens when I have the Way/Generators, Intervention/Image, or Laracasts/Flash packages installed

The error:


FatalErrorException in ServiceProvider.php line 60:
Call to undefined method Illuminate\Config\Repository::package()

The stack trace:


1) in ServiceProvider.php line 60

2) at HandleExceptions->fatalExceptionFromError(array('type' => '1', 'message' => 'Call to undefined method Illuminate\Config\Repository::package()', 'file' => '/home/vagrant/my-app/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php', 'line' => '60')) in HandleExceptions.php line 118

3) at HandleExceptions->handleShutdown()

Makes sense, it looks like the package() method was deleted from src/Illuminate/Config/Repository.php in this commit:

https://github.com/laravel/framework/commit/64c15a35d9578748671639748b83b21d16dbd6c2

0 likes
44 replies
alexleonard's avatar

Dang. This is somewhat unfortunate. Guess I will also need to remove intervention for the moment.

alexleonard's avatar

Hmm, this seems to throw an error with lots of packages. Dispatcher, ImageValidator.

Not too sure how to proceed.

winternight's avatar

I had to roll back even further. Seems to work when I use commit #846c935194a036901ba6b4397c8897fa51e19111.

RemiC's avatar

Yes, it's breaking all existing packages that call the $this->package(..) method in their service provider.

RemiC's avatar

Taylor is working on a new workbench feature that will not be part of the core but as a CLI tool. I'm excited to see what he comes up with as the workbench was one of the gray area in L4.

Just hope he will preserve some backward compatibility for existing packages..

1 like
imJohnBon's avatar

@RemiC Indeed, I'm really hoping some kind of legacy provider is released to make this backwards compatible. Looks like it's effecting quite a few things.

1 like
thsteinmetz's avatar

We were bitten by this very same thing. As @winternight noted, updating composer.json to be

 "require": {
  "laravel/framework": "dev-master#846c935194a036901ba6b4397c8897fa51e19111",
   ...
}

works. Hopefully we'll have support for older packages soon.

3 likes
imJohnBon's avatar

Damn, looks like the popular Laracasts Flash package was also effected since it uses the package method. Thanks for the specific commit to reference @thsteinmetz.

alexleonard's avatar

Does anyone know if this has been rectified yet? A little worried that I'm falling behind on laravel/laravel updates by avoiding composer updating..

imJohnBon's avatar

@alexleonard Been wondering the same thing. Might try to update this weekend and see how it goes. Will update here if I do.

MThomas's avatar

You can check this fairly simpel... Just grab a clean install of laravel, add a package (eg. Laravel Generators) to composer.json, run an update, add the service provider and run php artisan...

Did it this morning (CET) and the issue still existed.

2 likes
Magnetion's avatar

Yeah, I can confirm this issue still exists. Was curious and just checked too.

darvems's avatar

Does anyone know if this has been rectified yet? A little worried that I'm falling behind on laravel/laravel updates by avoiding composer updating.. This link has no title attribute.

MThomas's avatar

@darvems, 4 hours earlier it wan't fixed and as you can see on github there are no new commits made. And if you want to check if it is fixed, pull in a fresh laravel copy, add a package and it service provider (eg Jeffrey's gennerators) and run php artisan, voila you will see if the issue is fixed.

(that what we or anyone else has to do to check if it is fixed anyway).

slovenianGooner's avatar

I've done a composer update this morning and everything was fixed for me. Don't know how, just works.

EDIT: My bad, was referencing an old commit of L5.

thsteinmetz's avatar

Looks like the package manager service provider is unable to support existing packages. I am very curious to know what Taylor has in store for the future of packages but very bummed to not be be able to update L5 for almost two weeks over this. :(

imJohnBon's avatar

Just a note for anyone who has been following this, in the latest Laravel podcast https://www.youtube.com/watch?v=-543jY0cDuM around 4 minutes in Jeffrey and Taylor talk about the current problems with packages. It's still a tiny bit unclear, but the gist of it that I got was that there weren't going to be huge changes and the package stuff is the last thing on Taylor's todo list that he's probably going to be working on next week.

1 like
imJohnBon's avatar

Just keeping this thread updated for anyone like myself who is anxiously awaiting support for 3rd party packages to return to L5. Taylor tweeted this earlier in a conversation:

https://twitter.com/taylorotwell/status/550753989935906816

Sounds like he will be working on the package related stuff next week. Fingers crossed that it is backwards compatible!

2 likes
imJohnBon's avatar

@bruno.quaresma No updates yet that I've seen, I'm hoping since BETA is apparently happening this week that it will also be fixed this week. Admittedly, it's nerve wracking not knowing if backward compatibility is going to be preserved regardless :/.

Magnetion's avatar

Checked in with Taylor on Twitter tonight about this issue. He said he was done with the package handling updates. Based on his response, the package function that the error refers to has been removed. So if an older package uses that (like Intervention Image), my guess is it will not work unless updates are made to the package.

imJohnBon's avatar

@Magnetion Literally just read your twitter conversation with him and was going to post it here:

https://twitter.com/taylorotwell/status/553007842337103872

This is sort of a huge bummer, I mean I get it, but damn. So many commonly used packages will now need to be updated and will be unusable for who knows how long.

@jeffreyway , do you have plans to update some of the common laracasts packages? Like Flash?

edit: Going back and actually digging into what the $this->package method is actually doing; it's totally understandable that it's not backwards compatible. It'd pretty much be impossible for it to be.

winternight's avatar

Does anyone have an example package that has been updated already? Would be interesting to see the required code for registering Config etc.

Magnetion's avatar

@imJohnBon I agree with both of your thoughts. I can understand why it was taken out. I also am bummed to realize some of my packages I rely on will be unusable for an unknown amount of time. I may spend some time today and fork one to see if I can get it working to gauge the effort.

@winternight ditto. A working L5 example would be very educational

MisterPhilip's avatar

This is what I've done for my packages (using an example "foo/foobar" namespace. Basically replicates what was in the package method.

<?php namespace Foo\Foobar;

use Illuminate\Support\ServiceProvider;

class FoobarServiceProvider extends ServiceProvider
{

    /**
     * Should always be set to false if configs/views/etc. need to be loaded
     *
     * @var bool
     */
    protected $defer = false;

    /**
     * Bootstrap our application events.
     *
     * @return void
     */
    public function boot()
    {
        $this->registerConfig();
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        // Register your commands
    }

    /**
     * Register our config file
     *
     * @return void
     */
    protected function registerConfig()
    {
        // The path to the user config file
        $userConfigPath    = app()->configPath() . '/packages/foobar/foo/config.php';

        // Path to the default config
        $defaultConfigPath = __DIR__ . '/../../config/config.php';

        // Load the default config
        $config = $this->app['files']->getRequire($defaultConfigPath);

        if (file_exists($userConfigPath)) 
        {       
            // User has their own config, let's merge them properly
            $userConfig = $this->app['files']->getRequire($userConfigPath);
            $config     = array_replace_recursive($config, $userConfig);
        }

        // Set each of the items like ->package() previously did
        $this->app['config']->set('foobar::config', $config);
        $this->app['view']->addNamespace('foobar', __DIR__ . '/../../views');
        $this->app['translator']->addNamespace('foobar', __DIR__ . '/../../lang');
    }
}

This is of course assuming you have the following layout:

/config
    /config.php
/lang
/Foo
    /Foobar
        /FoobarServiceProvider.php
/views
5 likes
Next

Please or to participate in this conversation.