SoHo SoHo - 7 months ago 38
PHP Question

Using Authorize.Net SDK in Laravel 5.1 via composer

What is the best practice when using third-party SDKs with Laravel?

After loading SDK via composer like so...

composer require authorizenet/authorizenet:~1.8

Do I need to add AuthorizeNet class to providers list in /config/app.php

What needs to be added specifically and how to make class work in controller?

I'm trying to add
Authorizenet\AuthorizeNetARB::class, to /config/app.php

use Authorizenet\AuthorizeNetARB;

to my controller but getting this error:
FatalErrorException in ProviderRepository.php line 146:
Class 'Authorizenet\AuthorizeNetARB' not found


No you don't need to add it to your config/app.php because it's not a Laravel-package.

You can directly use AuthorizeNetARB because it's not namespaced.

$example = New \AuthorizeNetARB();