Mario Landa
Mario Landa

Reputation: 17

include the autoloader php

I am trying to install an SDK for OpenPay ( Mexican PayPal ) in laravel 5.2 and after doing the composer install it asks me to do this:

Finally, be sure to include the autoloader: require_once '/path/to/your-project/vendor/autoload.php';

I dont know where to put that, or what to do of it, I just dont understand. If I continue without doing that everytime I try to create an instance like

 $openpay = Openpay::getInstance();

I get an error saying

Class 'App\Http\Controllers\Openpay' not found

How can I fix this? Thank you!

Upvotes: 0

Views: 1020

Answers (1)

EddyTheDove
EddyTheDove

Reputation: 13259

When you did composer require openpay/sdk, composer already installed it. It's already part of your autoload. Now you can use it like this:

$openpay = \Openpay::getInstance();

Or add it to your controller first

...
use Openpay;

public function MyController extends Controller 
{
    $openpay = Openpay::getInstance();
}

Upvotes: 1

Related Questions