isinlor/freshbooks-php
Composer 安装命令:
composer require isinlor/freshbooks-php
包简介
Freshbook-php package
README 文档
README
Freshbooks PHP Library (forked from: https://code.google.com/p/freshbooks-php-library/)
Credit to Milan Rukavina (rukavinamilan@gmail.com) for developing the original library at the above URL.
Warning
Please note that the library from which this is forked has not been updated or maintained since May 2011. It has A LOT of bugs. It works for some basic tasks well (sending invoices, triggering payments via a payment gateway) but there are lot of "basic" functions that are broken (grabbing invoice details by invoice #, updating invoices as sent, etc.)
This library is only for the brave of heart and for those interested in helping fix up an outdated Freshbooks PHP library.
Initiation
To initialize the library, include an initiation block like below.
// Include particular file(s) for entity you need (Client, Invoice, Category…)
include_once "library/FreshBooks/Client.php";
// Your API url and token obtained from Freshbooks.com
$url = "your-url-please-replace";
$token = "your-token-please-replace";
// Cnit singleton FreshBooks_HttpClient
FreshBooks_HttpClient::init($url,$token);
Get Client Data
// New Client object
$client = new FreshBooks_Client();
// Try to get client with client_id 3
if (!$client->get(3)){
// No data – read error
echo $client->lastError;
}
else {
// Investigate populated data
print_r($client);
}
New Client
// new Client object
$client = new FreshBooks_Client();
//populate client’s properties
$client->email = ‘test@test.com’;
$client->firstName = ‘Chad’;
$client->lastName = ‘Smith’;
//all other required properties should be populated
//try to create new client with provided data on FB server
if(!$client->create()){
//read error
echo $client->lastError;
}
else {
//investigate populated data
print_r($client);
}
Lookup Invoice By InvoiceID #00000324301
$invoice = new Freshbooks_Invoice();
$invoice->get('00000324301')
or die("Unable to get Invoice: " . $invoice->lastError);
print_r($invoice);
Lookup Invoice(s) for Client #17992
$invoice = new Freshbooks_Invoice();
$invoice->listing($rows, $resultInfo, 1, 3, array('clientId' => 17992,
'status' => '',
'dateTo' => '',
'dateFrom' => '',
'recurringId' => ''))
or die("Unable to grab Invoice listing: " . $invoice->lastError);
if ($invoice) {
print_r($rows);
print_r($resultInfo);
}
Mark Invoice As Paid
$payment = new Freshbooks_Payment();
$payment->invoiceId = '00000324300';
// To mark payment as 'PAID', this amount must be the full amount outstanding on the invoice
$payment->amount = '2.44';
$payment->type = 'Bank Transfer';
$payment->create()
or die("Unable to mark Invoice as paid: " . $payment->lastError);
// Note: this will automatically send the client a payment notification e-mail
// letting them know that their invoice has been paid.
isinlor/freshbooks-php 适用场景与选型建议
isinlor/freshbooks-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 28 次下载、GitHub Stars 达 1, 最近一次更新时间为 2015 年 02 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 isinlor/freshbooks-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 isinlor/freshbooks-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 28
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2015-02-05