Puli Factory is not available error.
related 2.0
I get the same error. Additionally, the Puli Github page say this;
ATTENTION: This package is not maintained anymore.
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;
}
I following instructions in README and received this error as well.
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.
+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.
This issues is not related to the package puli/factory
Any updates on this from Mailgun?
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..
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
I get the same error. How to solve it..
I fixed it by explicitly setting the adapter in composer.json:
composer require "php-http/guzzle6-adapter: ^1.0"
Yeah~ Thank you ..
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
With this works:
$client = new \Http\Adapter\Guzzle6\Client(); $mailgun = new \Mailgun\Mailgun('api_key', $client);
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
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
This issue is fixed in 2.1
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.
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
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.
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"