[英]Adding 3rd party custom library in Yii2
I have a tax library avalara. 我有一个税收图书馆avalara。 How can I add it using Yii2.
如何使用Yii2添加它。 I have tried in putting in Vendor folder.
我试过放在Vendor文件夹中。 used
用过的
require "/vendor/avalara/avalara.php"
要求“ /vendor/avalara/avalara.php”
it does include the file does wasn't able to call the functions inside it. 它确实包含该文件,但无法调用其中的函数。
I have used the avalara library. 我已经使用了avalara库。 Extract the file and put the AvaTax and autoload foler in vendor.
提取文件,然后将AvaTax和自动加载文件放入供应商。 Add the a class file in model directory.
在模型目录中添加一个类文件。
$base_path = str_replace("frontend", "", \\Yii::$app->basePath);
$ base_path = str_replace(“ frontend”,“”,\\ Yii :: $ app-> basePath);
require_once $base_path .
require_once $ base_path。 'vendor/avalara/vendor/autoload.php';
'供应商/阿瓦拉拉/供应商/autoload.php';
use Yii;
使用Yii;
use AvaTax\\Address;
使用AvaTax \\ Address;
use AvaTax\\DetailLevel;
使用AvaTax \\ DetailLevel;
use AvaTax\\GetTaxRequest;
使用AvaTax \\ GetTaxRequest;
use AvaTax\\Line;
使用AvaTax \\ Line;
use AvaTax\\TaxServiceSoap;
使用AvaTax \\ TaxServiceSoap;
use AvaTax\\ATConfig;
使用AvaTax \\ ATConfig;
use AvaTax\\CancelTaxRequest;
使用AvaTax \\ CancelTaxRequest;
After that create custom functions and use them in controller. 之后,创建自定义函数并在控制器中使用它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.