New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

responsilicious/laravel-quickbooks-client

FORK OF SPINEN's Laravel Client for QuickBooks.
5,289
Install
composer require responsilicious/laravel-quickbooks-client
Latest Version:4.5.0.5
PHP:>=7.2
Laravel:5 · 6 · 7
License:MIT
Last Updated:Jan 31, 2023
Links: GitHub  ·  Packagist
Maintainer: Responsilicious

SPINEN's Laravel QuickBooks Client

Latest Stable Version Latest Unstable Version Total Downloads License

PHP client wrapping the QuickBooks PHP SDK.

We solely use Laravel for our applications, so this package is written with Laravel in mind. If there is a request from the community to split this package into 2 parts to allow it to be used outside of Laravel, then we will consider doing that work.

Build Status

Branch Status Coverage Code Quality
Develop Build Status Code Coverage Scrutinizer Code Quality
Master Build Status Code Coverage Scrutinizer Code Quality

Installation

Install QuickBooks PHP Client:

$ composer require Responsilicious/laravel-quickbooks-client

The package uses the auto registration feature of Laravel 5.

Configuration

  1. You will need a quickBooksToken relationship on your User model. There is a trait named Responsilicious\QuickBooks\Laravel\HasQuickBooksToken, which you can include on your User model, which will setup the relationship. NOTE: If your User model is not App/User, then you will need to configure the path in the configs/quickbooks.php as documented below.

  2. Add the appropriate values to your .env

    Minimal Keys
    QUICKBOOKS_CLIENT_ID=<client id given by QuickBooks>
    QUICKBOOKS_CLIENT_SECRET=<client secret>
    
    Optional Keys
    QUICKBOOKS_API_URL=<Development|Production> # Defaults to App's env value
    QUICKBOOKS_DEBUG=<true|false>               # Defaults to App's debug value
    
  3. [Optional] Publish configs & views

    Config

    A configuration file named quickbooks.php can be published to config/ by running...

    php artisan vendor:publish --tag=quickbooks-config
    
    Views

    View files can be published by running...

    php artisan vendor:publish --tag=quickbooks-views
    

Usage

Here is an example of getting the company information from QuickBooks:

php artisan tinker
Psy Shell v0.8.17 (PHP 7.1.14 — cli) by Justin Hileman
>>> Auth::logInUsingId(1)
=> App\User {#1668
     id: 1,
     // Other keys removed for example
   }
>>> $quickbooks = app('Responsilicious\QuickBooks\Client') // or app('QuickBooks')
=> Responsilicious\QuickBooks\Client {#1613}
>>> $quickbooks->getDataService()->getCompanyInfo();
=> QuickBooksOnline\API\Data\IPPCompanyInfo {#1673
     +CompanyName: "Sandbox Company_US_1",
     +LegalName: "Sandbox Company_US_1",
     // Other properties removed for example
   }
>>>

You can call any of the resources as documented in the SDK.

Middleware

If you have routes that will be dependent on the user's account having a usable QuickBooks OAuth token, there is an included middleware Responsilicious\QuickBooks\Laravel\Filter that gets registered as quickbooks that will ensure the account is linked and redirect them to the connect route if needed.

Here is an example route definition:

Route::view('some/route/needing/quickbooks/token/before/using', 'some.view')
     ->middleware('quickbooks');

Related Packages

spinen/laravel-quickbooks-client

SPINEN's Laravel Client for QuickBooks.

46,999 47
wearepixel/laravel-quickbooks

Laravel Client for QuickBooks.

3,122 1
sourcetoad/soapy

A Soap Client built for Laravel.

107,476 11

Version History

Version Released PHP Laravel License
4.5.0.5 >=7.2 5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0 MIT
4.5.0.4 >=7.2 5.5.*|5.6.*|5.7.*|5.8.* MIT
4.0.3 >=7.2 5.5.*|5.6.*|5.7.*|5.8.* MIT
4.0.2 >=7.2 5.5.*|5.6.*|5.7.*|5.8.* MIT
4.0.1 >=7.2 5.5.*|5.6.*|5.7.*|5.8.* MIT