Error installing this package on Laravel 5.8 (clunky workaround included...can we fix the package?)
Followed the instructions in the README and it just refused to work. This is what I had (at first) in my composer.json:
"require": {
"php": "^7.1.3",
"bogardo/mailgun": "^5.1",
"guzzlehttp/guzzle": "^6.3",
"laravel/framework": "5.8.*",
"laravel/tinker": "^1.0"
},
On running the commands in the https://github.com/Bogardo/Mailgun#http-client-dependency section, I saw this error:
OneStepAtATime:kb_skins kunalpunjabi$ composer require php-http/guzzle6-adapter
Using version ^2.0 for php-http/guzzle6-adapter
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Conclusion: don't install php-http/guzzle6-adapter v2.0.1
- Conclusion: don't install php-http/guzzle6-adapter v2.0.0
- Conclusion: remove php-http/httplug v1.1.0
- Installation request for php-http/guzzle6-adapter ^2.0 -> satisfiable by php-http/guzzle6-adapter[2.x-dev, v2.0.0, v2.0.1].
- Conclusion: don't install php-http/httplug v1.1.0
- php-http/guzzle6-adapter 2.x-dev requires php-http/httplug ^2.0 -> satisfiable by php-http/httplug[2.0.x-dev, v2.0.0].
- Can only install one of: php-http/httplug[2.0.x-dev, v1.1.0].
- Can only install one of: php-http/httplug[v2.0.0, v1.1.0].
- Installation request for php-http/httplug (locked at v1.1.0) -> satisfiable by php-http/httplug[v1.1.0].
Installation failed, reverting ./composer.json to its original content.
I then did the following (actually tried several things, the one below is what actually worked):
"require": {
"php": "^7.1.3",
"bogardo/mailgun": "^5.1",
"php-http/guzzle6-adapter": "^1.1",
"laravel/framework": "5.8.*",
"laravel/tinker": "^1.0"
},
"repositories": {
"vesper8/mailgun": {
"type": "vcs",
"url": "https://github.com/vesper8/mailgun"
}
}
In app/Providers/AppServiceProvider.php:
public function register()
{
//
$this->app->bind('mailgun.client', function() {
return \Http\Adapter\Guzzle6\Client::createWithConfig([
// your Guzzle6 configuration
]);
});
}
Then ran composer update and was able to "bulk" send emails using:
Route::get('/mail', function () {
$data = [
'customer' => 'Kevin P',
'url' => 'http://laravel.com'
];
Mailgun::send('emails.mailgun_test', $data, function($message){
$message->to('xyz@domain1.com', 'User One', [
'age' => 37,
'city' => 'New York'
])
->subject('Welcome!');
$message->to('abc@domain2.com', 'User Two', [
'age' => 41,
'city' => 'London'
])
->subject('Welcome Back!');
});
});
Can we fix the package so that we're not reliant on adding this to composer.json:
"repositories": {
"vesper8/mailgun": {
"type": "vcs",
"url": "https://github.com/vesper8/mailgun"
}
}
and also to fix the guzzle issues / install instructions?
"php-http/guzzle6-adapter": "^1.1",
Error installing this package on Laravel 5.8 (clunky workaround included...can we fix the package?)
Followed the instructions in the README and it just refused to work. This is what I had (at first) in my composer.json:
On running the commands in the https://github.com/Bogardo/Mailgun#http-client-dependency section, I saw this error:
I then did the following (actually tried several things, the one below is what actually worked):
In app/Providers/AppServiceProvider.php:
Then ran
composer updateand was able to "bulk" send emails using:Can we fix the package so that we're not reliant on adding this to composer.json:
and also to fix the guzzle issues / install instructions?