Download the PHP package chrisjohnleah/sage-business-cloud-accounting-api without Composer
On this page you can find all versions of the php package chrisjohnleah/sage-business-cloud-accounting-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download chrisjohnleah/sage-business-cloud-accounting-api
More information about chrisjohnleah/sage-business-cloud-accounting-api
Files in chrisjohnleah/sage-business-cloud-accounting-api
Package sage-business-cloud-accounting-api
Short Description Framework-agnostic PHP SDK for the Sage Business Cloud Accounting API (v3.1), built on Saloon.
License MIT
Homepage https://github.com/chrisjohnleah/sage-business-cloud-accounting-api
Informations about the package sage-business-cloud-accounting-api
Sage Business Cloud Accounting API — PHP SDK
A modern, framework-agnostic PHP SDK for the Sage Business Cloud Accounting API (v3.1), built on Saloon. Typed responses, OAuth2 with rotating-refresh handling, X-Business targeting, automatic $next pagination, and rate-limit / 429 backoff — all baked in.
Using Laravel? Reach for the companion bridge
chrisjohnleah/sage-business-cloud-accounting-api-laravelfor a service provider, an Eloquent token store, andsage:connect/sage:synccommands.
Why this package
The Sage Accounting API has sharp edges that this SDK smooths over for you:
| Sage quirk | What the SDK does |
|---|---|
| 5-minute access tokens | Refreshes proactively before expiry |
| Rotating refresh tokens (single-use) | Surfaces the rotated token so you can persist it |
Mandatory X-Business header |
Applied automatically once a business is selected |
| No webhooks | First-class incremental polling via updated_or_created_since / deleted_since |
Body-based $next pagination |
Iterated transparently — foreach over every record |
| Rate limits (100/min per company) | Honours 429 Retry-After and backs off exponentially |
Requirements
- PHP 8.3+
- A Sage Developer app (OAuth2 client id + secret) — register at developerselfservice.sageone.com
Installation
Quick start
1. Send the user to Sage to authorise
2. Handle the callback
3. Read data (auto-refreshes, auto-paginates)
Persisting tokens
Implement Contracts\TokenStore to store tokens wherever you like (the Laravel bridge ships an Eloquent one). Sage rotates the refresh token on every refresh, so your put() must always overwrite the previous record:
Coverage
The entire Sage Accounting v3.1 API. Every schema (200+) has a typed DTO and every operation (280+, including writes) has a request class — generated from the OpenAPI spec and verified by contract tests, so coverage can't silently regress.
Ergonomic, lazily-paginated resources are provided for the common entities (businesses(), contacts(), purchaseInvoices()); every other endpoint is reachable by sending its generated request through $sage->connector():
Regenerating from the spec
The hand-crafted core (connector, OAuth, paginator, client, Reference/Paginated) is never touched — only the leaf DTOs and request classes are generated.
Testing
Tests never hit the network — every request is faked with Saloon's MockClient.
Contributing
Issues and PRs welcome — see SECURITY.md.
Licence
MIT © Chris John Leah. See LICENSE.
Not affiliated with or endorsed by The Sage Group plc. "Sage" is a trademark of its respective owner.
All versions of sage-business-cloud-accounting-api with dependencies
saloonphp/saloon Version ^4.0
saloonphp/pagination-plugin Version ^2.0
saloonphp/rate-limit-plugin Version ^2.0