Reputation: 7159
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 ?
Upvotes: 1
Views: 427
Reputation: 60058
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
Upvotes: 4