News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
PHP SDK Class not found
Tags: sdk
Jun 26, 2020 at 3:41pm   •   4 replies  •  0 likes
Ellen Sleight

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);

4 Answers
answered on Aug 11, 2020 at 6:34am  

Hi Ellen, have you solved this issue yet? Looking at your code I can't tell what server you are trying to connect to. I use the more direct approach by loading straight from the Class. Here is my code for both sandbox and production (I control how I want to connect with a DB table entry of sandbox on or off:

if ($ringcentral_sandbox == 1) {
// Use sandbox Client
$sdk = new RingCentral\SDK\SDK($client_id, $client_secret, RingCentral\SDK\SDK::SERVER_SANDBOX);
} else {
// Use Production Client
$sdk = new RingCentral\SDK\SDK($client_id, $client_secret, RingCentral\SDK\SDK::SERVER_PRODUCTION);
}

This removes the need to have the server name typed in correctly. Not sure this is the culprit but it may make your code a little more streamlined.

Basically I'm just replacing the Server parameter with:

RingCentral\SDK\SDK::SERVER_SANDBOX

or

RingCentral\SDK\SDK::SERVER_PRODUCTION



 1
answered on Jun 29, 2020 at 9:47am  

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"));


 0
answered on Jun 27, 2020 at 9:00am  

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(
);

 0
answered on Jun 26, 2020 at 7:59pm  

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


 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us