murrion / bullethq
此包的最新版本(dev-master)没有提供许可信息。
BulletHQ API的包装类
dev-master
2014-01-26 15:15 UTC
Requires
- phpunit/phpunit: 3.7.29
This package is not auto-updated.
Last update: 2024-09-24 01:05:39 UTC
README
BulletHQ是一个在线发票和工资应用,更多信息请访问 http://www.bullethq.com/
BulletHQ有一个很棒的API,并且已经相当容易使用。src/bullethq.php中的类文件是为了学习API而创建的,也许可以使其他PHP开发者更容易使用它。
##使用方法##
首先,将您的用户名和API密钥添加到credentials.inc.php中,然后在您的PHP文件中使用以下内容
在您的PHP页面的顶部添加以下内容
require_once('src/bullethq.php');
require_once('credentials.inc.php');
$bullet = new \bullethq\bullethq($username, $password);
####获取客户数据####
$clients = $bullet->get('clients'); // to receive a list of all existing clients
$client = $bullet->get('clients', '12345'); // to receive the details attached to a specific client, where 12345 is a client ID taken from the initial list of clients
####获取发票数据####
$invoices = $bullet->get('invoices'); // to receive all existing invoices
$invoice = $bullet->get('invoices', '12345'); // to receive a specific invoice
####获取供应商数据####
$suppliers = $bullet->get('suppliers'); // to receive all existing suppliers
$supplier = $bullet->get('suppliers', '12345'); // to receive a specific supplier
####获取客户付款数据####
$client_payments = $bullet->get('clientPayments'); // to retrieve all client payments
$client_payment = $bullet->get('clientPayments', '28854'); // to retrieve a client payment
####提交新客户####
$new_client_data = array(
"name" => "New Client name",
"addressLine1" => "address 1",
"addressLine2" => "address 2",
"email" => "example@domain.com",
"phoneNumber" => "123456789",
"vatNumber" => "ei23456",
"country" => "Ireland"
);
$new_client = $bullet->post('clients', $new_client_data);
####提交新发票####
$new_invoice_data = array(
"clientName" => "Sample Client Name",
"currency" => "EUR",
"invoiceNumber" => 100,
"issueDate" => "2014-01-01",
"dueDate" => "2014-01-01",
"draft" => true,
"invoiceLines" => array(array(
"quantity" => 1,
"rate" => "500",
"vatRate" => 0.23,
"description" => "Testing",
"item" => "Day"
))
);
$new_invoice = $bullet->post('invoices', $new_invoice_data);
####提交新供应商####
$new_supplier_data = array(
"name" => "New Supplier 1",
"addressLine1" => "address 1",
"addressLine2" => "address 2",
"phoneNumber" => "123456789",
"vatNumber" => "ei23456",
"country" => "Ireland"
);
$new_supplier = $bullet->post('suppliers', $new_supplier_data);
####提交新客户付款数据####
$new_payment_data = array(
'amount' => '100', // The Euro amount that the client has paid
'dateReceived' => '2014-01-01',
'currency' => 'EUR',
'bankAccountId' => 1234, // Your Bank account ID in Bullet HQ
'clientId' => 12345, // The client that has made a payment
'invoiceIds' => array(array('1234')) // An existing Invoice ID that a client is paying
);
$new_payment = $bullet->post('clientPayments', $new_payment_data);
####删除发票数据####
$bullet->delete('invoices', '12345'); // delete an invoice (note: this is not YOUR invoice ID, it is BulletHQ's ID for the record)
$results = $bullet->delete_all('invoices'); // delete all invoices (lists all invoices first then deletes them individually)
####删除客户数据####
$bullet->delete('clients', '12345'); // delete a client (note: all payment data attached to the client must be deleted first
$results = $bullet->delete_all('clients'); // delete all invoices (lists all invoices first then deletes them individually)
####删除供应商数据####
$bullet->delete('suppliers', '12345'); // delete a supplier (note: all payment data attached to the client must be deleted first
$results = $bullet->delete_all('suppliers'); // delete all suppliers (lists all suppliers first then deletes them individually)
####删除客户付款数据####
$bullet->delete('clientPayments', '12345'); // delete a client payment
$results = $bullet->delete_all('clientPayments'); // delete all client payments
##测试状态##