dcblogdev/laravel-xero
Laravel package for integrating the Xero accounting API into your app. Handles OAuth 2.0 authentication, token refresh, and provides a clean interface for invoices, contacts, payments, and other Xero endpoints, so you can sync accounting data without writing boilerplate API code.
Architecture fit: dcblogdev/laravel-xero is a Laravel package that integrates Xero’s accounting API via OAuth2. It provides a service provider, facade (Xero), configuration file, token model, and middleware for token refresh. It fits naturally into Laravel’s architecture (Eloquent, facades, config publishing, migrations) and is appropriate for Laravel applications that need to read/write Xero data (contacts, invoices, payments, etc.). The package is a thin wrapper around Xero’s REST API, so it does not abstract Xero’s domain model—developers still need Xero API knowledge.
Integration feasibility: Integration is straightforward: composer require dcblogdev/laravel-xero, publish config and migrations, configure Xero app credentials, and set up OAuth routes. The package handles token storage and refresh. The v1.1.18 change—dropping accounting.transactions from default scopes—means new installations will not request transaction-related scopes (invoices, bank transactions, etc.) by default. Existing applications that relied on default scopes for these endpoints must explicitly add accounting.transactions to the scopes config. This is a config-level change but can silently break auth flows if not caught, especially since it is a patch release.
Technical risk:
accounting.transactions. Apps that did not customize scopes will lose access to transaction endpoints after re-authentication. This is a behavioral break for some consumers despite the patch version.Key questions:
Stack fit: The package is designed for Laravel applications (8.x–11.x) running PHP 8.0+. It integrates with Laravel’s auth system, uses Eloquent for token persistence, and provides a facade for API calls. It is a good fit for standard Laravel monoliths or APIs that need Xero integration.
Migration path: If currently using raw Guzzle or another Xero client, you can adopt this package incrementally:
xero_tokens table (or re-authenticate users).Xero facade.scopes config and explicitly add accounting.transactions if transaction endpoints are used. Re-authenticate affected users to obtain the new scope.Compatibility: Verify the package’s composer.json for Laravel/PHP constraints. Xero API changes (e.g., deprecations) may require package updates; pin to a stable version and test upgrades in staging. The scope change in v1.1.18 is backward-incompatible for default-scope consumers, so treat it as a minor breaking change despite the patch version.
Sequencing:
accounting.transactions if needed).Xero facade; add error handling for 401/403/429.Maintenance: Monitor the package’s releases and changelog for breaking changes like the v1.1.18 scope default change. Xero API updates may require package upgrades; single-maintainer risk means occasional delays. Budget for periodic review and testing.
Support: Community support via GitHub issues; documentation covers basic setup but may lack advanced scenarios (multi-tenant, rate limiting). Teams may need Xero API expertise internally. Consider contributing fixes upstream or forking if critical.
Scaling: Token storage scales with database, but multi-tenant and high-volume scenarios require custom handling:
Failure modes:
accounting.transactions) → 403 Forbidden.Ramp-up: Developers need Laravel familiarity plus basic Xero API knowledge (endpoints, data models, OAuth2). The package reduces boilerplate, but understanding Xero’s scopes and rate limits is essential. Estimated ramp-up: 1–2 days for basic integration, 1–2 weeks for production-grade multi-tenant, rate-limited implementation. The v1.1.18 scope change should be highlighted in onboarding docs to avoid surprises.
How can I help you explore Laravel packages today?