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

onoufriosm's avatar

Mailgun api problem

Hi all.

I've installed the official mailgun api package (https://github.com/mailgun/mailgun-php). I instantiate a client but then when I try to get the mail lists using I get the following error:

RuntimeException in /vendor/php-http/discovery/src/ClassDiscovery.php line 32: Puli Factory is not available

Any help will be highly appreciated. Thanks.

0 likes
3 replies
onoufriosm's avatar

Just to let you know I've solved the issue.

I was using: $mailgun = new Mailgun('api_key');

I changed that to:

$client = new \Http\Adapter\Guzzle6\Client(); $mailgun = new \Mailgun\Mailgun('api_key', $client);

Now it works!

rsteinmann's avatar

Hey onoufriosm,

how did you set this up? I try to use the mailgun API within my laravel environment, but I don't get this done. You have any tutorial for this?

I did include the mailgun within my composer.json and updated it successfully.

Now in one of my Controllers I try to pass the Laravel Guzzle Client to instanciate a new Mailgun object. But it throws me back an error:

ErrorException in Mailgun.php line 38: Argument 2 passed to Mailgun\Mailgun::__construct() must be an instance of Http\Client\HttpClient, instance of GuzzleHttp\Client given, called in /Users/rsteinmann/Sites/api.zir.net/app/Http/Controllers/Mails/MailController.php on line 60 and defined

Looks like it is not compatible?

Would be nice to know how you did get this to run!

Thanks

kalakaari's avatar

Have you installed php composer.phar require php-http/guzzle6-adapter:^1.0 I was having the same problem and after installing Guzzle adapter the problem is solved. May be this help somebody :)

Please or to participate in this conversation.