felconca/qbo-helpers
最新稳定版本:v1.1
Composer 安装命令:
composer require felconca/qbo-helpers
包简介
QuickBooks Online PHP helper package
README 文档
README
QuickBooks Online PHP Helper Package
A lightweight PHP library that provides an easy-to-use interface for interacting with the QuickBooks Online API. This package includes both a low-level service class for direct API calls and a fluent facade for simple, chainable operations.
Purpose
- Simplifies QuickBooks Online API integration in PHP projects.
- Provides CRUD operations (
create,update,delete,findAll,findById) for QBO entities. - Supports raw queries and filtering.
- Handles sandbox and production environments.
- Compatible with PHP 7.4+.
Installation
Install via Composer:
composer require felconca/qbo-helpers
Manual installation:
- Download or clone the repository.
- Include the
autoload.phporQuickBooksOnline.phpfiles manually (Composer is preferred).
Helpers Usage
1. Initialize QBO
<?php require_once __DIR__ . '/vendor/autoload.php'; use QuickBooksOnlineHelper\Facades\QBO; QBO::setAuth('YOUR_COMPANY_ID', 'YOUR_ACCESS_TOKEN', true); // last param: sandbox (true/false)
2. Fetch all entities
$customers = QBO::all()->Customer(); echo json_encode($customers['data']);
3. Fetch entity by ID
$invoice = QBO::get()->Invoice(101); // 101 = entity ID echo json_encode($invoice['data']);
4. Create a new entity
$data = [ "DocNumber" => "101", "Line" => [ [ "Description" => "Sewing Service for Alex", "Amount" => 150.00, "DetailType" => "SalesItemLineDetail", "SalesItemLineDetail" => [ "ItemRef" => ["value" => 1, "name" => "Services"] ] ] ], "CustomerRef" => ["value" => "1", "name" => "Alex"] ]; $newInvoice = QBO::create()->Invoice($data); echo json_encode($newInvoice['data']);
5. Update an entity
$updateData = [ "Id" => "101", "SyncToken" => "0", "DocNumber" => "102" ]; $updatedInvoice = QBO::update()->Invoice($updateData); echo json_encode($updatedInvoice['data']);
6. Delete an entity
$deletedInvoice = QBO::delete()->Invoice("101", "0"); // ID, SyncToken echo json_encode($deletedInvoice['data']);
7. Run a custom query
$invoices = QBO::query()->Invoice("WHERE DocNumber = '101'"); echo json_encode($invoices['data']);
Features
- Fluent interface for chainable API calls.
- Automatic handling of sandbox and production endpoints.
- PHP 7.4+ compatible.
- Supports all main QBO entities:
Invoice,Customer,Item, etc. - Query builder support for custom SQL-like queries.
Project is currently private & copyright protected © [Felcon Albaladejo]
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-11