Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: Puli Factory class does not exist #49

Closed
tegansnyder opened this issue Jul 6, 2016 · 13 comments
Closed

Fatal error: Puli Factory class does not exist #49

tegansnyder opened this issue Jul 6, 2016 · 13 comments
Assignees

Comments

@tegansnyder
Copy link
Contributor

I'm able to install this client by composer; however, when I attempt to call the CrawlBot API I get an error. Here is my code:

require '/vendor/autoload.php';

use Swader\Diffbot\Diffbot;

$diffbot = new Diffbot('my_token');
$crawl = $diffbot->crawl('SomeSite');
$job = $crawl->call();

var_dump($job->getDownloadUrl("json"));

Here is the error that is returned:

PHP Fatal error:  Uncaught RuntimeException: Puli Factory class does not exist in /app/vendor/php-http/discovery/src/ClassDiscovery.php:38
Stack trace:
#0 /app/vendor/php-http/discovery/src/ClassDiscovery.php(79): Http\Discovery\ClassDiscovery::getPuliFactory()
#1 /app/vendor/php-http/discovery/src/ClassDiscovery.php(99): Http\Discovery\ClassDiscovery::getPuliDiscovery()
#2 /app/vendor/php-http/discovery/src/HttpClientDiscovery.php(21): Http\Discovery\ClassDiscovery::findOneByType('Http\\Client\\Htt...')
#3 /app/vendor/swader/diffbot-php-client/src/Diffbot.php(102): Http\Discovery\HttpClientDiscovery::find()
#4 /app/vendor/swader/diffbot-php-client/src/Diffbot.php(268): Swader\Diffbot\Diffbot->setHttpClient()
#5 /private/var/www/sov/shell/get_diffbot_data.php(17): Swader\Diffbot\Diffbot->crawl('SomeSiteName')
#6 {main}
  thrown in /app/vendor/php-http/discovery/src/ClassDiscovery.php on line 38

My composer.json contains:

{
    "minimum-stability": "dev",
    "prefer-stable": true,
    "require": {
        "php-http/guzzle6-adapter": "~1.0",
        "php-http/message": "^1.2",
        "php-http/discovery": "~0.8.0",
        "puli/cli": "~1.0",
        "php-http/plugins": "~1.0",
        "puli/composer-plugin":"^1.0",
        "swader/diffbot-php-client": "^2.1@dev"
    }
}

I'm wondering if there is an issue upstream somewhere. Ideas?

@jonathantullett
Copy link

I'm also having the same issue. I've tried with the latest php-http/guzzle6-adapter (1.1) and stable (2.0) version of the Diffbot client.

@tegansnyder
Copy link
Contributor Author

I tried with stable too. Same issue.

@jonathantullett
Copy link

@Swader - any thoughts on this one?

@Swader
Copy link
Owner

Swader commented Jul 19, 2016

That's interesting. I cannot reproduce this. I used your exact composer.json and your exact test code (replaced with my token and my job name), but no dice, works just fine. Investigating further...

@Swader
Copy link
Owner

Swader commented Jul 19, 2016

Successfully reproduced - tested on wrong VM which already had Puli globally installed.

@sagikazarmark
Copy link

Hi everyone,

We recently invested some work in improving our discovery strategies. As part of that, we removed the hard dependency on Puli.

So if you don't want to use Puli, just remove the composer plugin and update the php-http/discovery dependency to ^1.0. It comes with a few clients built-in (official httplug ones). For custom ones you can write custom discovery strategies or use Puli. Please refer to the documentation or ask us on slack.

If you want to use Puli: unfortunately there are many points where Puli might go wrong. Can you please check the composer install log and see that the puli build command ran fine (also you could run it manually: puli build)? You might need to download the puli.phar into your project root (although discovery comes with one). Also, please check to update your global puli binary to the latest if you have any.

There is also an autoloading problem with composer >= 1.0 && PHP >= 5.6: puli/issues#190

Unfortunately the fix has not been merged yet.

@Swader
Copy link
Owner

Swader commented Jul 19, 2016

Okay, initiating surgical removal of Puli from all parts of the client, thanks @sagikazarmark

@Swader
Copy link
Owner

Swader commented Jul 21, 2016

@jonathantullett @tegansnyder

Sorry about the delay in getting this fixed guys, I have now removed Puli and updated dependencies, should all work.

@Swader Swader closed this as completed Jul 21, 2016
@tegansnyder
Copy link
Contributor Author

Thanks for fixing this. I appreciate it.

On Thursday, July 21, 2016, Bruno Škvorc notifications@github.com wrote:

@jonathantullett https://github.com/jonathantullett @tegansnyder
https://github.com/tegansnyder

Sorry about the delay in getting this fixed guys, I have now removed Puli
and updated dependencies, should all work.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#49 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABJQQyAEJXM_V_zSISWyORY0mKRYWv3Xks5qXy_GgaJpZM4JGZoe
.

Tegan Snyder

@jonathantullett
Copy link

I've done a fresh 'composer require Swader/diffbot-php-client' and it's still pulling in Puli:

jbookpro:core-code tullettj$ composer require Swader/diffbot-php-client
Using version ^2.0 for Swader/diffbot-php-client
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
[...]
  - Installing ramsey/uuid (2.9.0)
    Downloading: 100%

  - Installing puli/discovery (1.0.0-beta9)
    Loading from cache

  - Installing puli/repository (1.0.0-beta10)
    Loading from cache

  - Installing puli/url-generator (1.0.0-beta4)
    Loading from cache

  - Installing puli/composer-plugin (1.0.0-beta10)
    Downloading: 100%

And then it fails at runtime with PHP Fatal error: Uncaught RuntimeException: Puli Factory class does not exist

Any suggestions, @Swader? I'm sure I'm missing something simple... :)

Thanks!

@Swader
Copy link
Owner

Swader commented Jul 25, 2016

Ah, I forgot to tag a new release, very sorry! Try again please!

@jonathantullett
Copy link

We have lift off! (and the install looks a lot cleaner too!)

Thank you very much :)

@Swader
Copy link
Owner

Swader commented Jul 25, 2016

Glad it works now :) Sorry it took a while, been swamped, hopefully can update further soon, lots of new features coming

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants