IsraelOrtuno / pipedrive

Complete Pipedrive API client for PHP
MIT License
166 stars 58 forks source link

Running script outside of Laravel gives an error #28

Closed wesf90 closed 7 years ago

wesf90 commented 7 years ago

I'm trying to create an activity and I keep receiving this error:

PHP Fatal error: Class 'Illuminate\Support\Str' not found in /path/to/src/Pipedrive.php on line 66

I've simply included the Pipedrive.php file from within my PHP file (via require). I am not using Laravel or composer.

IsraelOrtuno commented 7 years ago

Can you show your code please?

On Wed, 23 Aug 2017 at 05:52, Wes Foster notifications@github.com wrote:

I'm trying to create an activity and I keep receiving this error:

PHP Fatal error: Class 'Illuminate\Support\Str' not found in /path/to/src/Pipedrive.php on line 66

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/IsraelOrtuno/pipedrive/issues/28, or mute the thread https://github.com/notifications/unsubscribe-auth/ABr_yWZ-oArFmyFyyFUl9zAtL8Y84QU8ks5sa6IHgaJpZM4O_dSh .

--

Un saludo Israel Ortuño

IsraelOrtuno commented 7 years ago

Just a question, did you install using composer and required autoload.php?

wesf90 commented 7 years ago

The code is just a simple require and initialization:

require('pipedrive-master/src/Pipedrive.php');
$token = 'foo';
$pipedrive = new Devio\Pipedrive\Pipedrive($token);

And no, I didn't install via composer--just the require. If this is the problem, we could work towards decoupling it when not installed via composer if there aren't too many missing dependencies.

Thanks

IsraelOrtuno commented 7 years ago

I am afraid that this package uses more dependences as Guzzle and Illuminate\Support. Probably these use a few of others.

I recommend to use Composer.

If you really can't use it, you could download the entire package, run a composer install which will generate the vendor directory with all the required dependences and then copy all the files to your projects folder. You could then require the vendor/autoload.php which would do all the requires for you.