Back

Cannot redeclare GuzzleHttp\Promise\queue()


Hello,

Today I ran into a problem which I could not solve. I am developing at the moment some different packages. Lets say package 1 and package 2. Both of the packages are using guzzlehttp/client.

In both service providers I register GuzzleHttp/Client with

$this->app->singleton('GuzzleHttp\Client', function()
{
    return new Client;
});

And in both packages I bind the custom class. e.g.

// Package 1

$this->app->bind('Me\Foo', function($app)
{
    return new Foo($app['GuzzleHttp\Client'], $app['config']);
});

// Package 2

$this->app->bind('Me\Bar', function($app)
{
    return new Bar($app['GuzzleHttp\Client'], $app['config']);
});

Now when I add both package to the providers array in file 'config/app.php' I received the following error.

Cannot redeclare GuzzleHttp\Promise\queue() (previously declared in /Users/me/Sites/laravel-workbench/me/package-1/vendor/guzzlehttp/promises/src/functions.php:26) in /Users/me/Sites/laravel-workbench/me/package-2/vendor/guzzlehttp/promises/src/functions.php on line 34

What am I doing wrong?

Here is a link to one of the package's service provider: JustYoServiceProvider

Thanks!


Sign in to participate in this thread!



We'd like to thank these amazing companies for supporting us