PHPackages                             lifeonscreen/laravel-quickbooks - 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. lifeonscreen/laravel-quickbooks

ActiveLibrary

lifeonscreen/laravel-quickbooks
===============================

Laravel Quickbooks integration

v0.0.2(7y ago)191.1k26[9 issues](https://github.com/LifeOnScreen/laravel-quickbooks/issues)[2 PRs](https://github.com/LifeOnScreen/laravel-quickbooks/pulls)MITPHPCI failing

Since May 29Pushed 6y ago2 watchersCompare

[ Source](https://github.com/LifeOnScreen/laravel-quickbooks)[ Packagist](https://packagist.org/packages/lifeonscreen/laravel-quickbooks)[ Docs](https://github.com/LifeOnScreen/laravel-quickbooks)[ RSS](/packages/lifeonscreen-laravel-quickbooks/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (4)Versions (4)Used By (0)

laravel-quickbooks
==================

[](#laravel-quickbooks)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c401cdf6e1517912019d68324955e4e8da7d6df8554974c6d121dd8e3f86f1c1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6966656f6e73637265656e2f6c61726176656c2d717569636b626f6f6b732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lifeonscreen/laravel-quickbooks)[![Total Downloads](https://camo.githubusercontent.com/8bc07286cbf99c16e4ad5ae936224103216b24659b6eba153a71ab9abcd8037d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c6966656f6e73637265656e2f6c61726176656c2d717569636b626f6f6b732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lifeonscreen/laravel-quickbooks)

Take a look at [contributing.md](contributing.md) to see a to do list.

Installation
------------

[](#installation)

Via Composer

```
$ composer require lifeonscreen/laravel-quickbooks
```

Publish package and run migrations

```
$ php artisan vendor:publish
$ php artisan migrate
```

Usage
-----

[](#usage)

### Configuration

[](#configuration)

These are the variables you need to set in your .env.

```
# Client ID from the app's keys tab.
QB_CLIENT_ID=

# Client Secret from the app's keys tab.
QB_CLIENT_SECRET=

# The redirect URI provided on the Redirect URIs part under keys tab.
QB_REDIRECT_URI=

# Quickbooks scope com.intuit.quickbooks.accounting or com.intuit.quickbooks.payment
QB_SCOPE=

# Development/Production
QB_BASE_URL=

```

### Token Handling

[](#token-handling)

Since every application is setup differently, you will need to create a class that extends `QuickBooksTokenHandler` to persist the tokens in your database. By default, the tokens are stored using the Laravel Cache API for 7 days.

For example, if you use the [Laravel Options](https://github.com/appstract/laravel-options) package you would create the following class somewhere in your project:

```
namespace App\QuickBooks;

use LifeOnScreen\LaravelQuickBooks\QuickBooksTokenHandler;

class TokenHandler extends QuickBooksTokenHandler
{
    public function set($key, $value)
    {
        option([$key => $value]);
    }

    public function get($key)
    {
        return option($key);
    }
}
```

Then bind it in your `AppServiceProvider.php`:

```
public function boot()
{
    $this->app->bind(
        \LifeOnScreen\LaravelQuickBooks\QuickBooksTokenHandlerInterface::class,
        \App\QuickBooks\TokenHandler::class
    );
}
```

### Connect QuickBooks account

[](#connect-quickbooks-account)

To connect your application with your QuickBooks company you can use `QuickBooksAuthenticator` helper. It has two methods:

- `getAuthorizationUrl()` - Returns redirect URL and puts `quickbooks_auth` cookie into Laravel cookie queue. Cookie is valid for 30 minutes.
- `processHook()` - Validates `quickbooks_auth` cookie and sets realm id, access token and refresh token.

Usage example:

```
namespace App\Http\Controllers;

use LifeOnScreen\LaravelQuickBooks\QuickBooksAuthenticator;
use Cookie;

class QuickBooksController extends Controller
{
    public function connect()
    {
        return redirect(QuickBooksAuthenticator::getAuthorizationUrl())
            ->withCookies(Cookie::getQueuedCookies());
    }

    public function refreshTokens()
    {
        if (QuickBooksAuthenticator::processHook()) {
            return 'Tokens successfully refreshed.';
        }

        return 'There were some problems refreshing tokens.';
    }
}
```

### Sync Eloquent model to QuickBooks

[](#sync-eloquent-model-to-quickbooks)

You can either extend the `LifeOnScreen\LaravelQuickBooks\QuickBooksEntity` class which is already extending the Eloquent model or you can use the `LifeOnScreen\LaravelQuickBooks\SyncsToQuickBooks` trait.

Then you have to define:

- `quickBooksResource` - One of the QuickBooks resources classes (e.g.. `\LifeOnScreen\LaravelQuickBooks\Resources\Company::class`).
- `getQuickBooksArray()` - This method must return the associative array which will be synced to QuickBooks.
- `quickBooksIdColumn` (optional) - The column to use for storing the QuickBooks ID (defaults to `quickbooks_id`)

Usage example:

```
namespace App\Models\Company;

use LifeOnScreen\LaravelQuickBooks\QuickBooksEntity;
use LifeOnScreen\LaravelQuickBooks\Resources\Customer;

class Company extends QuickBooksEntity
{
    /**
     * Database column name
     * This is optional default value is 'quickbooks_id'
     * @var string
     */
    protected $quickBooksIdColumn = 'quickbooks_id';

    /**
     * Use one of LifeOnScreen\LaravelQuickBooks\Resources classes
     * @var array
     */
    protected $quickBooksResource = Customer::class;

    /**
     * @return array
     */
    protected function getQuickBooksArray(): array
    {
        return [
            'CompanyName'  => 'Example name',
            'DisplayName'  => 'Example display name',
            //...
        ];
    }
}
```

When you want to sync a resource you must call `syncToQuickBooks()`. Method returns true if syncing is successful. You can get last QuickBooks error with method `getLastQuickBooksError()`.

Syncing example:

```
/**
 * @return string
 * @throws \Exception
 */
public function syncExample()
{
    $company = Company::find(1);
    if ($company->syncToQuickBooks()){
        return 'Success';
    }
    return $company->getLastQuickBooksError();
}
```

### Using the QuickBooks Resource Classes

[](#using-the-quickbooks-resource-classes)

You can use the included resource classes in `LifeOnScreen\LaravelQuickBooks\Resources` to create, update, and query resources from QuickBooks.

Examples:

```
$customer = new LifeOnScreen\LaravelQuickBooks\Resources\Customer;

// create
$customer->create([
    'GivenName'  => 'John',
    'FamilyName' => 'Smith',
]);

// update item with ID "123"
$customer->update(123, [
    'GivenName'  => 'John',
    'FamilyName' => 'Smith',
]);

// find by ID:
$customer->find(123);

// find by a specific field:
$customer->findBy('FamilyName', 'Smith');

// find multiple items:
$customer->query();

```

See `QuickBooksResource.php` for further documentation.

Changelog
---------

[](#changelog)

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

Contributing
------------

[](#contributing)

Please see [contributing.md](contributing.md) for details and a todolist.

Security
--------

[](#security)

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

Credits
-------

[](#credits)

- [Jani Cerar](https://github.com/janicerar), [Aaron Harp](https://github.com/arharp)

License
-------

[](#license)

MIT license. Please see the [license file](license.md) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~160 days

Total

2

Last Release

2744d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/38758825?v=4)[LifeOnScreen](/maintainers/LifeOnScreen)[@LifeOnScreen](https://github.com/LifeOnScreen)

---

Top Contributors

[![arharp](https://avatars.githubusercontent.com/u/531493?v=4)](https://github.com/arharp "arharp (4 commits)")[![janicerar](https://avatars.githubusercontent.com/u/29040621?v=4)](https://github.com/janicerar "janicerar (4 commits)")[![aharp-afg](https://avatars.githubusercontent.com/u/39571284?v=4)](https://github.com/aharp-afg "aharp-afg (1 commits)")

---

Tags

laravellaravel-quickbooks

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lifeonscreen-laravel-quickbooks/health.svg)

```
[![Health](https://phpackages.com/badges/lifeonscreen-laravel-quickbooks/health.svg)](https://phpackages.com/packages/lifeonscreen-laravel-quickbooks)
```

###  Alternatives

[slowlyo/owl-admin

基于 laravel、amis 开发的后台框架~

61214.2k26](/packages/slowlyo-owl-admin)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)[highsolutions/eloquent-sequence

A Laravel package for easy creation and management sequence support for Eloquent models with elastic configuration.

121130.3k](/packages/highsolutions-eloquent-sequence)[glhd/linen

21135.6k](/packages/glhd-linen)

PHPackages © 2026

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