mailgun-php icon indicating copy to clipboard operation
mailgun-php copied to clipboard

Puli Factory is not available error.

Open irfanevrens opened this issue 10 years ago • 23 comments

related 2.0

irfanevrens avatar Apr 02 '16 16:04 irfanevrens

I get the same error. Additionally, the Puli Github page say this;

ATTENTION: This package is not maintained anymore.

matthendrix avatar Apr 04 '16 00:04 matthendrix

Workaround I use is setting the HTTP client explicitely, as documented in README.

    public function send($to, $body, $subject)
    {

        $client = new \Http\Adapter\Guzzle6\Client();
        $mg = new \Mailgun\Mailgun($this->key, $client);
        $domain = $this->domain;

        $mg->sendMessage($domain, array('from'    => '[email protected]', 
                                        'to'      => $to, 
                                        'subject' => $subject, 
                                        'text'    => $body));

        return true;
    }

dirkpostma avatar Apr 04 '16 09:04 dirkpostma

I following instructions in README and received this error as well.

bshaffer avatar Apr 05 '16 23:04 bshaffer

same problem here

PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Puli Factory is not available'

The Puli Factory package has been abandoned

https://packagist.org/packages/puli/factory This package is abandoned and no longer maintained. No replacement package was suggested.

andrekutianski avatar Apr 06 '16 20:04 andrekutianski

+1

Puli Factory is not available

If you get an error that says “Puli Factory is not available”, it means that you have failed to install Puli. You should make sure you install the latest version of puli/composer-plugin.

source

This issues is not related to the package puli/factory

yassine-ah avatar Apr 14 '16 10:04 yassine-ah

Any updates on this from Mailgun?

cschalenborgh avatar Apr 26 '16 09:04 cschalenborgh

I got this response from their support team.

Per the recent update you now need to add a new line and change an old line when using the SDK. There are some instructions under the "Installation" portion of https://github.com/mailgun/mailgun-php that go into this in some detail, however here specifically are the lines:

New line:
$client = new \Http\Adapter\Guzzle6\Client();

Changed line:
Used to be:
$mgClient = new Mailgun('key-goes-here');

Now is:
$mailgun = new \Mailgun\Mailgun('api_key', $client);

Also, please make sure the variable you are calling in the send function now includes $mailgun instead of $mgClient.

Here is an example on how sending a basic message looks like now with the recent update:

<?php
# Include the Autoloader (see "Libraries" for install instructions)
require 'vendor/autoload.php';
use Mailgun\Mailgun;

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

# Instantiate the client.
$domain = "domain.com";

# Make the call to the client.
$result = $mailgun->sendMessage($domain, array(
    'from'    => 'Excited User <[email protected]>',
    'to'      => 'Baz <[email protected]>',
    'subject' => 'Hello',
    'text'    => 'Testing some Mailgun awesomness!'));

$id = $result->http_response_body->id;
echo $id

?>

Hope this helps..

cschalenborgh avatar Apr 27 '16 15:04 cschalenborgh

Doesn't work for me - even with the fix above I get

Catchable fatal error: Argument 1 passed to Http\Adapter\Guzzle6\Client::buildClient() must be of the type array, none given, called in /home/shatgame/public_html/site.net/vendor/php-http/guzzle6-adapter/src/Client.php on line 31 and defined in /home/shatgame/public_html/site.net/vendor/php-http/guzzle6-adapter/src/Client.php on line 76

ghost avatar May 10 '16 01:05 ghost

I get the same error. How to solve it..

undefinedor avatar May 10 '16 17:05 undefinedor

I fixed it by explicitly setting the adapter in composer.json:

composer require "php-http/guzzle6-adapter: ^1.0"

bshaffer avatar May 10 '16 18:05 bshaffer

Yeah~ Thank you ..

undefinedor avatar May 11 '16 03:05 undefinedor

Hmm didn't work for me still getting this,

2016-05-15 13:19:31: (mod_fastcgi.c.2673) FastCGI-stderr: PHP Fatal error:  Uncaught exception 'RuntimeException' with message 'Puli Factory is not available' in /var/www/vendor/php-http/discovery/src/ClassDiscovery.php:32
2016-05-15 13:19:31: (mod_fastcgi.c.2673) FastCGI-stderr: Stack trace:
2016-05-15 13:19:31: (mod_fastcgi.c.2673) FastCGI-stderr: #0 /var/www/vendor/php-http/discovery/src/ClassDiscovery.php(79): Http\Discovery\ClassDiscovery::getPuliFactory()
2016-05-15 13:19:31: (mod_fastcgi.c.2673) FastCGI-stderr: #1 /var/www/vendor/php-http/discovery/src/ClassDiscovery.php(99): Http\Discovery\ClassDiscovery::getPuliDiscovery()
2016-05-15 13:19:31: (mod_fastcgi.c.2673) FastCGI-stderr: #2 /var/www/vendor/php-http/discovery/src/HttpClientDiscovery.php(21): Http\Discovery\ClassDiscovery::findOneByType('Http\Client\Htt...')
2016-05-15 13:19:31: (mod_fastcgi.c.2673) FastCGI-stderr: #3 /var/www/vendor/mailgun/mailgun-php/src/Mailgun/Connection/RestClient.php(270): Http\Discovery\HttpClientDiscovery::find()
2016-05-15 13:19:31: (mod_fastcgi.c.2673) FastCGI-stderr: #4 /var/www/vendor/mailgun/mailgun-php/src/Mailgun/Connection/RestClient.php(87): Mailgun\Connection\RestClient->getHttpClient()
2016-05-15 13:19:31: (mod_fastcgi.c.2673) FastCGI-stderr: #5 /var/www/vendor/mailgun/mailgun-php/src/Mailgun/Connection/RestClient.php(138): Mailgun\Connection\RestClient->send('POST', 'mg.website.com...', Array, Array)
2016-05-15 13:19:31: (mod_fastcgi.c.2673) FastCGI-stderr: #6 /var/www/vendor/mailgun/mailgun-php/src/Mailgun/Mailgun.php(110): Mailgun\C in /var/www/vendor/php-http/discovery/src/ClassDiscovery.php on line 32

d4rkd0s avatar May 15 '16 17:05 d4rkd0s

With this works:

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

carlituxman avatar Jun 21 '16 10:06 carlituxman

composer require "php-http/guzzle6-adapter: ^1.0" " Could not find package ^1.0 at any version for your minimum-stability (stab le). Check the package spelling or your minimum-stability "

i solved by versin ^1.1 composer require php-http/guzzle6-adapter

shahidbasheer avatar Jul 16 '16 07:07 shahidbasheer

This PR will fix the issue as it updates php-http/discovery to 1.0. That version does no longer require Puli

https://github.com/mailgun/mailgun-php/pull/139/files#diff-b5d0ee8c97c7abd7e3fa29b9a27d1780R8

Nyholm avatar Jul 20 '16 22:07 Nyholm

This issue is fixed in 2.1

Nyholm avatar Jul 20 '16 22:07 Nyholm

Received the same issue, Google led me here, have mailgun-php version 2.1.2 installed... Not sure what I missed, but it appears to still not be working.

jasonmccreary avatar Oct 25 '16 00:10 jasonmccreary

Have a look at the documentation for Httplug: http://docs.php-http.org/en/latest/discovery.html#puli-factory-is-not-available

Also, Are you running php-http/discovery > 1.0? Have you installed the message factories? php-http/message Have you installed a client? php-http/curl-client Have you installed a PSR7 implementation? guzzlehttp/psr7

Nyholm avatar Oct 25 '16 06:10 Nyholm

Also, Are you running php-http/discovery > 1.0?

Yes. Version 1.1.

Have you installed a client?

Yes, I installed php-http/guzzle6-adapter and adjusted the code per the comments above to get it working.

I think it was just unclear from the comments here, docs, and common composer install practices what I needed to do to get it working.

jasonmccreary avatar Oct 26 '16 00:10 jasonmccreary

Total 3 packages are required to run it properly mailgun/mailgun-php, php-http/curl-client, guzzlehttp/psr7

So in your composer.json add

"mailgun/mailgun-php": "latest",
"php-http/curl-client": "latest",
"guzzlehttp/psr7": "latest"

debojyoti avatar Aug 03 '18 06:08 debojyoti