question

Ellen Sleight avatar image
Ellen Sleight asked Ellen Sleight edited

PHP SDK Class not found

I installed the RingCentral PHP SDK.

I created the "ringout.php" file.

When executing it, it says "PHP Fatal error: Class 'RingCentral\SDK\SDK' not found...", which it isn't.

What am I missing?

$rcsdk = new RingCentral\SDK\SDK($RINGCENTRAL_CLIENTID, $RINGCENTRAL_CLIENTSECRET, $RINGCENTRAL_SERVER);

php sdk
1 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image
Phong Vu answered

Do you see the "/vendor/ringcentral/" folder under your project folder? Or check if that exists where you install SDK into.

1 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Ellen Sleight avatar image
Ellen Sleight answered Phong Vu commented

Yes. I see vendor/ringcentral and all of the other files.

My script includes (variables below are defined)

require('vendor/autoload.php');

use RingCentral\SDK\SDK;

$rcsdk = new SDK($RINGCENTRAL_CLIENTID, $RINGCENTRAL_CLIENTSECRET, $RINGCENTRAL_SERVER);

and I actually echoed variables to the screen to make sure each file was included (as I executed from the Linux command line)... It does include SDK.php.

The error specified is on the line where it says "new SDK" ( figured I'd mention it).

Also... I noticed that the autoload_classmap.php file is basically empty. Unsure if this should be the case:

<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);
1 comment
1 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image Phong Vu ♦♦ commented ·

I believe it is about your environment. I found this discussion on stack overflow that may help you.

0 Likes 0 ·
Ellen Sleight avatar image
Ellen Sleight answered Ellen Sleight edited

I saw this discussion as well. I did the below and it is bool(true).

I even echo debug output from SDK.php and it works... although, it doesn't see the class SDK when I do get_declared_classes().

<?php

require('vendor/autoload.php');

var_dump(file_exists("vendor/autoload.php"));

1 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.