mahan-shoghy / laravel-quickbooks
Laravel QuickBooks API Implementation
Requires
- php: ^8.1
This package is auto-updated.
Last update: 2025-02-17 21:47:09 UTC
README
Laravel Quickbooks API Package simplifies integration with the Quickbooks API in Laravel applications.
For now, only OAuth2, Item and Webhook functionality is released.
Feel free to add more features!
Table of Contents
Installation
Via composer (Laravel 10+):
composer require mahan-shoghy/laravel-quickbooks
Optional: If you want to publish the config file, use the following command:
php artisan vendor:publish --provider="MahanShoghy\LaravelQuickBooks\QuickBooksServiceProvider" --tag="config"
Usage
Setup environment
Add and set these variables to your environment file:
QUICKBOOKS_CLIENT_ID=
QUICKBOOKS_CLIENT_SECRET=
QUICKBOOKS_WEBHOOK_VERIFIER_TOKEN=
You can create credentials and get values from the Quickbooks App Dashboard
API
Explore the various API endpoints provided by the Quickbooks API, organized into the following categories:
Each section provides detailed instructions on how to interact with the Quickbooks API for different aspects of your business.
Webhook
Webhooks allow your Laravel application to receive and handle Quickbooks events in real-time. Follow these steps to set up webhook handling in your application.
- Define a Webhook Route: In your Laravel routes file (like: web.php), add a route for handling webhooks. You can choose any URL you prefer:
Route::quickbooksWebhooks('your-webhook-url');
- Add Verifier Token: After adding the webhook URL in the Quickbooks Dashboard, it will provide you with a verifier token. Copy and use this token as the value for
QUICKBOOKS_WEBHOOK_VERIFIER_TOKEN
in your environment file. Configure Webhook Events: Open the
quickbooks.php
configuration file (which you published in Installation) and specify the events you want to handle and the corresponding job classes.In the
jobs
array, define your webhook event handlers using the format{NAME}_{OPERATION}
, where:{NAME}
: Represents the entity or object type associated with the event.{OPERATION}
: Indicates the specific action or operation being performed on the entity.
For example:
'jobs' => [ 'ITEM_CREATE' => ItemCreatedJob::class, 'CUSTOMER_UPDATE' => CustomerUpdatedJob::class, 'INVOICE_DELETE' => InvoiceDeletedJob::class, ]
In the job class, you can access the entity data sent by Quickbooks to handle the event.
class ItemCreatedJob implements ShouldQueue { public array $realmId; public array $entity; public function __construct(string $realmId, array $entity) { $this->realmId = $realmId; $this->entity = $entity; } public function handle(): void { // Handle the webhook event using $this->entity } }
Event Documentation: You can find a list of available Quickbooks webhook events in the Quickbooks documentation. This resource will help you understand and configure the events you wish to handle.
Use Laravel Queues: For better performance and scalability, consider using Laravel queues to handle webhook jobs asynchronously. This ensures that your application remains responsive even during heavy webhook traffic.
Now, your Laravel application is ready to receive and process Quickbooks webhook events in real-time.
Support
If you have any questions or need assistance, feel free to contact us. if there are specific code examples you'd like to include in the README to help users get started quickly, you can add those as well.
Donate
If you find this package helpful and would like to support its development, you can make a donation in cryptocurrency. Your contributions will help maintain and improve this package.
You can send your contribution to the following address in your MetaMask wallet:
Wallet Address:
0x4B3d57AC72B57a76b778Bac4e3b32d2d4d729955
Thank you for your support!