简体   繁体   English

通过Composer在Laravel 5.1中使用Authorize.Net SDK

[英]Using Authorize.Net SDK in Laravel 5.1 via composer

What is the best practice when using third-party SDKs with Laravel? 在Laravel中使用第三方SDK的最佳实践是什么?

After loading Authorize.net SDK via composer like so... 像这样通过作曲家加载Authorize.net SDK之后...

composer require authorizenet/authorizenet:~1.8

Do I need to add AuthorizeNet class to providers list in /config/app.php 我是否需要将AuthorizeNet类添加到/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 and use Authorizenet\\AuthorizeNetARB; 我试图将Authorizenet\\AuthorizeNetARB::class, to /config/app.php添加Authorizenet\\AuthorizeNetARB::class, to /config/app.phpuse Authorizenet\\AuthorizeNetARB; to my controller but getting this error: FatalErrorException in ProviderRepository.php line 146: Class 'Authorizenet\\AuthorizeNetARB' not found 到我的控制器但收到此错误:ProviderRepository.php第146行中出现FatalErrorException:找不到类'Authorizenet \\ AuthorizeNetARB'

No you don't need to add it to your config/app.php because it's not a Laravel -package. 不,您不需要将其添加到config/app.php因为它不是Laravel软件包

You can directly use AuthorizeNetARB because it's not namespaced. 您可以直接使用AuthorizeNetARB因为它没有命名空间。

$example = New \AuthorizeNetARB();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM