Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Xero Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

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:

  • Scope change (v1.1.18): Default scopes no longer include 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.
  • Maintenance: Single maintainer (dcblogdev) but active. Risk of delayed updates for Xero API changes.
  • API rate limits: Xero enforces per-tenant rate limits; the package does not appear to include built-in rate-limit handling or queuing.
  • Token refresh: Middleware handles refresh, but edge cases (concurrent requests, expired refresh tokens) require custom handling.
  • Multi-tenant support: Token storage is per-user (or per-model), but managing multiple Xero organisations per user is not natively supported; custom logic needed.
  • Laravel/PHP compatibility: Must verify supported versions (likely Laravel 8–11, PHP 8.0+). Older Laravel versions may require package version pinning.

Key questions:

  • What Laravel and PHP versions are officially supported?
  • How are scopes configured, and is there a migration guide for the v1.1.18 scope change?
  • Does the package handle Xero’s 429 rate limiting with retries/backoff?
  • Is token storage encrypted at rest?
  • What is the test coverage and CI status?
  • How does the package handle Xero API versioning (e.g., Accounting API 2.0)?
  • Is there support for multiple Xero tenants per user?

Integration Approach

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:

  1. Install the package and publish config/migrations.
  2. Migrate existing OAuth tokens into the xero_tokens table (or re-authenticate users).
  3. Replace manual token refresh logic with the package’s middleware.
  4. Optionally replace manual API calls with the Xero facade.
  5. For existing installations upgrading to v1.1.18, audit the 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:

  1. Create a Xero app in the Xero Developer Portal; note client ID/secret.
  2. Install package, publish config and migrations.
  3. Configure credentials and explicitly define required scopes (including accounting.transactions if needed).
  4. Run migrations for token table.
  5. Set up OAuth redirect/callback routes (package provides guidance).
  6. Implement token refresh middleware (or use package’s built-in).
  7. Build API calls using the Xero facade; add error handling for 401/403/429.
  8. For multi-tenant, design a mapping between Laravel users and Xero tenant IDs, and store tokens accordingly.

Operational Impact

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:

  • Rate limiting: implement queuing/backoff for Xero’s per-tenant limits.
  • Token refresh: ensure concurrency safety (e.g., database locks) to avoid race conditions.
  • Multiple Xero organisations: extend token model with tenant mapping; package does not natively support this.

Failure modes:

  • Missing or expired tokens → 401 Unauthorized.
  • Insufficient scopes (e.g., after v1.1.18 upgrade without adding accounting.transactions) → 403 Forbidden.
  • Rate limit exceeded → 429 Too Many Requests; need retry logic.
  • Network timeouts or Xero outages → API failures; implement retries and circuit breakers.
  • Token refresh failure (revoked access) → re-authentication required; provide user prompts.

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.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console