Php 如何在codeigniter公共类型中集成XeroAPI
我想将xero集成到我的codeigniter(PHP)站点。你能请任何人帮帮我吗。是否有用于公共类型xero api的库 谢谢检查一下这个 -希望能有所帮助。我已经使用这个Git hub链接实现了XeroAPI。我们可以在laravel框架或codeigniter框架中部署和使用该库。我在laravel框架中使用了私有类型或公共类型Php 如何在codeigniter公共类型中集成XeroAPI,php,json,xml,codeigniter,Php,Json,Xml,Codeigniter,我想将xero集成到我的codeigniter(PHP)站点。你能请任何人帮帮我吗。是否有用于公共类型xero api的库 谢谢检查一下这个 -希望能有所帮助。我已经使用这个Git hub链接实现了XeroAPI。我们可以在laravel框架或codeigniter框架中部署和使用该库。我在laravel框架中使用了私有类型或公共类型 首先配置专用应用程序设置 <?php namespace XeroPHP\Application; require ''; use XeroP
首先配置专用应用程序设置
<?php
namespace XeroPHP\Application;
require '';
use XeroPHP\Application;
use XeroPHP\Models\Accounting\Invoice;
class PrivateApplication extends Application
{
/**
* @param array $config
*/
public function __construct()
{
$key = file_get_contents("file://privatekey.pem");
$config = [
'oauth' => [
'callback' => 'http://localhost/',
'consumer_key' => '',
'consumer_secret' => '',
'rsa_private_key' => $key,
],
];
//As we don't need to Authorize/RequestToken, it's populated here.
$config['oauth']['token'] = $config['oauth']['consumer_key'];
parent::__construct($config);
}
}
请在此添加一个代码示例,因为该链接将来可能会无效。添加了一些有关PrivateApplication的信息。请不要将代码作为屏幕截图发布。如果有人想复制它,他必须用手打字,而不是用c&p。直接插入代码并将其格式化为代码。好吧,这样看起来好多了!请在此添加一个代码示例,因为该链接将来可能会无效。
public function get()
{
$xero = new PrivateApplication();
$startDateString = date('Y, m, d');
$endDateString = date('Y, m, d', strtotime('-30 days'));
$invoices = $xero->load(Invoice::class)
->orderBy("Date", "DESC")
->where(sprintf('Date >= DateTime(%s)', $endDateString))
->where('Status', Invoice::INVOICE_STATUS_AUTHORISED)
->where('Type', Invoice::INVOICE_TYPE_ACCREC)
->execute();
return $invoices;
}