dirkgroenen / pinterest-api-php

A PHP wrapper for the official Pinterest API. :pushpin:
https://developers.pinterest.com/docs/getting-started/introduction/
Apache License 2.0
173 stars 76 forks source link

Request that you update the readme for laravel users. #73

Closed njdubois closed 6 years ago

njdubois commented 6 years ago

This isn't an issue and I'd rather have a way to contact you directly.

I had "use DirkGroenen\Pinterest\Pinterest;" on the top of my class, but was getting class "DirkGroenen\Pinterest\Pinterest" not found error.

My solution was to add: 'Pinterest' => DirkGroenen\Pinterest\Pinterest::class,

To the aliases element of config/app.php and then :

use Pinterest

Maybe make note of that in the read me?

njdubois commented 6 years ago

I apologize, it seems that did not fix my problem. Now I am getting:

at HandleExceptions->handleError(2, 'Class \'DirkGroenen\\Pinterest\\Pinterest\' not found', '[PATH-TO-PROJECT]/vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php', 79, array('alias' => 'Pinterest'))

njdubois commented 6 years ago

I cannot figure out what is going on here, I'm going to post more details in hopes that there is a solution. It really feels like it is staring me in the face!

The code wasn't setup by me. There was another developer who wrote this code and I adopted it. If he set something up that is causing this, I wouldn't be surprised.

I'm still getting this error: Class 'DirkGroenen\Pinterest\Pinterest' not found

As far as I can tell, the package is included with the app per the documentation in the read me.

The composer.json file: "dirkgroenen/Pinterest-API-PHP": "^0.2.11"

At the top of the class I am calling the library from: use DirkGroenen\Pinterest\Pinterest;

And the calling code: $pinterest = new Pinterest(env('PINTEREST_KEY'), env('PINTEREST_SECRET'));

And this is where I am getting the class not found error.

PhpStorm see's everything! If I remove the USE at the top of the file, "Pinterest" in "new Pinterest" get's high lighted, if I import class, it adds use DirkGroenen\Pinterest\Pinterest; top the top of the file. If I trace the code of that use, it points to vendor/dirkgroenen/pinterest-api-php/src/Pinterest/Pinterest.php

Let me be clear, I don't think there is anything wrong with this package. Following the code, everything looks like it is the way it should be.

Does anyone have any thoughts why this is happening? There are other libraries being used from the vendor folder no issue. Just this one.

Thanks a million.

dirkgroenen commented 6 years ago

Closing this due inactivity. I hope you've found the solution for your problem.