PHPackages                             webleit/zohobookslaravelserviceprovider - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. webleit/zohobookslaravelserviceprovider

ActiveLibrary[API Development](/categories/api)

webleit/zohobookslaravelserviceprovider
=======================================

Laravel Service Provider for Zoho Books. Works with both Laravel Cashier and Laravel Spark

2.3.0(7y ago)44054[1 issues](https://github.com/Weble/ZohoBooksLaravelServiceProvider/issues)MITPHPPHP ~7.0

Since Feb 1Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Weble/ZohoBooksLaravelServiceProvider)[ Packagist](https://packagist.org/packages/webleit/zohobookslaravelserviceprovider)[ Docs](https://github.com/webleit/zohobookslaravelserviceprovider)[ RSS](/packages/webleit-zohobookslaravelserviceprovider/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (6)Versions (18)Used By (0)

Zoho Books Laravel Service Provider for Cashier and Spark
=========================================================

[](#zoho-books-laravel-service-provider-for-cashier-and-spark)

This package provides Zoho Books integration for Laravel Spark and Laravel Cashier

Features
--------

[](#features)

This package automatically integrates zoho books with Laravel Spark and Laravel Cashier. Specifically:

- It creates a new `Zoho Contact` for each new paying subscriber you have, linking it to you `User` class
- It creates a new `Zoho Invoice` for each new payment received (just stripe at the moment) and links it to the `Invoice` from Cashier or the `LocalInvoice` from Spark
- It closes the invoice registering the payment linking it to stripe in zoho books
- It triggers new events that Spark doesn't trigger, specifically `Invoice Created` and `LocalInvoiceCreated` when a new Cashier invoice and a new Spark LocalInvoice are created
- It overrides the default Spark notification to send the Zoho Books Invoice instead of the Spark invoice as the attachment
- It overrides the downloading of the pdf serving the zoho books pdf instead of the Spark pdf in the user settings page
- It works for both subscriptions and single charges
- It automatically generates the required tax lines on Zoho Books (for us Europeans)

Install
-------

[](#install)

### 1. Install via Composer

[](#1-install-via-composer)

```
$ composer require webleit/zohobookslaravelserviceprovider
```

The service provider gets autodiscovered by Laravel new autodiscover feature.

### 2. Publish vendor config, routes and migrations

[](#2-publish-vendor-config-routes-and-migrations)

You can publish configuration and migrations using

`php artisan vendor:publish`

### 3. Run the migrations

[](#3-run-the-migrations)

Run the migrations to add the `zohobooks_id` fields to the users and invoices tables.

`php artisan migrate`

### 4. Override the Stripe webhook route

[](#4-override-the-stripe-webhook-route)

Register the new route for the Stripe Webhook controller. This needs manually because the spark service provider is registered by the application, and therefore is always loaded after any package.

In your `RouteSeviceProvider`, inside the `map` method, add:

`$router->post('webhook/stripe', 'Webleit\ZohoBooksLaravelServiceProvider\Http\Controllers\StripeWebhookController@handleWebhook');`

so that your final code looks like this:

```
public function map(Router $router)
{
    $this->mapWebRoutes($router);
    $this->mapApiRoutes($router);

    $router->post('webhook/stripe', 'Webleit\ZohoBooksLaravelServiceProvider\Http\Controllers\StripeWebhookController@handleWebhook');
}

```

### 5. (Optional) Download the Zoho Books Invoice instead of the Spark one

[](#5-optional-download-the-zoho-books-invoice-instead-of-the-spark-one)

If you want the user to download the zoho invoice instead of the spark invoice from his settings page, add the `HasZohoBooksInvoices` to the `App\User` class.

### 6. (Optional) Add Zoho Books methods to the LocalInvoice class

[](#6-optional-add-zoho-books-methods-to-the-localinvoice-class)

If you have overridden the `LocalInvoice` class for spark, you can add to it the handy trait `UseZohoBooksInvoice`which adds a lots of useful methods to it:

- `asInvoice()` to get the Cashier Invoice
- `asZohoBooksInvoice()` to get the ZohoBooks Invoice
- `pdf($storagePath = null)` to get the PDF content of the invoice
- `downloadPdf($storagePath = null)` to download the PDF content of the invoice

Configuration
-------------

[](#configuration)

When you publish the config file, you can add 3 parameters to it:

- `authtoken` (set through the env variable `ZOHOBOOKS_AUTHTOKEN`), which is the zoho auth token to be used, which you can get [here](https://accounts.zoho.com/apiauthtoken/create?SCOPE=ZohoBooks%2Fbooksapi)
- `organization_id` (set through the env variable `ZOHOBOOKS_ORGANIZATION_ID`), which is the organization ID you want to work on.If the account you provided has just one organization, this can be null.
- `invoice_storage_path` When you need the zoho books invoice PDF, it gets stored locally for cache. This is the path in the storage dir where it gets stored as a pdf file. Defaults to `invoices`

The Repository
--------------

[](#the-repository)

All the interactions that you might need are stored in the `ZohoBooksInvoiceRepository` class:

- `createOnZohoBooks (App\User $billable, Laravel\Cashier\Invoice $invoice, Laravel\Spark\LocalInvoice $localInvoice)` creates both contact and invoice on ZohoBooks, checking if this wasn't already done.
- `updateZohoContact (App\User $billable)` updates an existing contact on zohobooks
- `getZohoInvoice($invoiceId)` get the zoho books invoice using the zoho's invoice id
- `storeAndGetZohoInvoicePdf(Laravel\Spark\LocalInvoice $localInvoice, $storagePath = null)` get the pdf content of the zoho books invoice, storing it locally for cache
- `downloadZohoInvoicePdf(LocalInvoice $localInvoice, $storagePath = null)` download the pdf of the zoho invoice, storing it locally for cache

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- \[Daniele Rosario\]\[\]

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~19 days

Recently: every ~37 days

Total

16

Last Release

2739d ago

Major Versions

1.2.2 → 2.0.02018-02-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/2fe88932c3280467c9a30f79205c0f2c85aecd28dae3a9e8b035d773ef6218ef?d=identicon)[Skullbock](/maintainers/Skullbock)

---

Top Contributors

[![Skullbock](https://avatars.githubusercontent.com/u/1104083?v=4)](https://github.com/Skullbock "Skullbock (41 commits)")

---

Tags

booksinvoicelaravelsparkzoholaravelZohosparkcashierzoho bookswebleitzohobookslaravelserviceprovider

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/webleit-zohobookslaravelserviceprovider/health.svg)

```
[![Health](https://phpackages.com/badges/webleit-zohobookslaravelserviceprovider/health.svg)](https://phpackages.com/packages/webleit-zohobookslaravelserviceprovider)
```

###  Alternatives

[essa/api-tool-kit

set of tools to build an api with laravel

52680.5k](/packages/essa-api-tool-kit)[flat3/lodata

OData v4.01 Producer for Laravel

96320.9k](/packages/flat3-lodata)[ryangjchandler/bearer

Minimalistic token-based authentication for Laravel API endpoints.

8129.8k](/packages/ryangjchandler-bearer)[asciisd/zoho

Asciisd Zoho provide an elegant and easy way to communicate with Zoho CRM.

3751.9k](/packages/asciisd-zoho)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
