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 ?

1

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

How can I call a function?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.