1

I have a php file plivo.php in app/plivo folder. This included in my controller like,

require app_path().'/plivo/plivo.php';

The plivo.php contains a class, RestAPI .

When I try to create an object like,

        $auth_id = "Your AUTH_ID";
        $auth_token = "Your AUTH_TOKEN";

        $p = new RestAPI($auth_id, $auth_token);

Produce an error:

Class 'Controllers\Account\RestAPI' not found

How can I create this object ?

Vinod VT
  • 6,946
  • 11
  • 51
  • 75

1 Answers1

4

As your class is not namespaced - try and call it like this:

    $auth_id = "Your AUTH_ID";
    $auth_token = "Your AUTH_TOKEN";

    $p = new \RestAPI($auth_id, $auth_token);

Notice the \ before RestAPI

Laurence
  • 58,936
  • 21
  • 171
  • 212