Problems Calling an API in external libraries

I have the below code (ON AFTER INSERT/UPDATE EVENTS) which is supposed to send an sms using the Twilio REST API. However the code is throwing an error where
I have the

Use Twilio\Rest\Client
line saying

Parse error: syntax error, unexpected ‘use’ (T_USE) in …\scriptcase\app ests\send_sms\send_sms_apl.php on line 1973

I will be happy if somebody can point me in the right direction on how to call this API from an external library.

require_once ‘…/Twilio/Twilio/autoload.php’;

// Use the REST API Client to make requests to the Twilio REST API
use Twilio\Rest\Client;

// Your Account SID and Auth Token from
$sid = ‘’;
$token = '
$client = new Client($sid, $token);

// Use the client to do fun stuff like send text messages!
// the number you’d like to send the message to
// A Twilio phone number you purchased at
‘from’ => ‘Sending_Number’,
// the body of the text message you’d like to send
‘body’ => “sms sent from php!”


Apparently you dont fully understand the mechanism. Check out
and use REST calls.
use Twilio\Rest\Client I guess you havent installed the twilio code.
Look at :
I assume you havent installed that without using composer. So check the part: Using without composer

Hi rr,

i had already done the installation described on the part USING WITHOUT COMPOSER. I can even see the Twilio Library in my scriptcase’ External Libraries but where I am having a problem is how to call the rest api as scriptcase (php) tells me am using the use Twilio\Rest\Client statement wrongly (Unexpected ‘use’ (T_USE) in …).

Thanks for your comment and i will be happier if you can come back with more suggestions on how i can resolve this problem.

sc_include_library(“prj”, “Twilio”, “vendor/autoload.php”);
$sid = ‘[sid]’;
$token = ‘[token]’;
$twilio = new Twilio\Rest\Client($sid, $token);

$message = $twilio->messages
->create(“whatsapp:+5688888888”, // to
“from” => “whatsapp:+5699999999”,
“body” => “Hello there!”