PHPackages                             compwright/oauth2-quickbooks-online - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. compwright/oauth2-quickbooks-online

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

compwright/oauth2-quickbooks-online
===================================

Quickbooks Online OAuth 2.0 Client Provider for The PHP League OAuth2-Client

v2.0.0(5mo ago)011.8k—3.6%1[1 PRs](https://github.com/compwright/oauth2-quickbooks-online/pulls)MITPHPPHP ^8.3

Since Dec 12Pushed 5mo agoCompare

[ Source](https://github.com/compwright/oauth2-quickbooks-online)[ Packagist](https://packagist.org/packages/compwright/oauth2-quickbooks-online)[ RSS](/packages/compwright-oauth2-quickbooks-online/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (4)Used By (0)

Quickbooks Online Provider for OAuth 2.0 Client
===============================================

[](#quickbooks-online-provider-for-oauth-20-client)

[![Latest Version](https://camo.githubusercontent.com/6cf7683a2a92e93321df9a8b70f2ebc61e1e5bba042209d55b6e26de7f53e861/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f636f6d707772696768742f6f61757468322d717569636b626f6f6b732d6f6e6c696e652e7376673f7374796c653d666c61742d737175617265)](https://github.com/compwright/oauth2-quickbooks-online/releases)[![Build Status](https://camo.githubusercontent.com/57b19a61e463837875f62289575281bb4e4d8eb24cc94af452461aa0453b5ca4/68747470733a2f2f6170702e7472617669732d63692e636f6d2f636f6d707772696768742f6f61757468322d717569636b626f6f6b732d6f6e6c696e652e7376673f6272616e63683d6d6173746572)](https://app.travis-ci.com/github/compwright/oauth2-quickbooks-online)[![Total Downloads](https://camo.githubusercontent.com/28c11f6279b953b4d23b7ea3757d60c2464f90cfa98833a365bc514aadd8e047/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f6d707772696768742f6f61757468322d717569636b626f6f6b732d6f6e6c696e652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/compwright/oauth2-quickbooks-online)

This package provides Quickbooks Online OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).

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

[](#installation)

To install, use composer:

```
composer require compwright/oauth2-quickbooks-online league/oauth2-client

```

Usage
-----

[](#usage)

Usage is the same as The League's OAuth client, using `\Compwright\OAuth2_Quickbooks_Online\Provider` as the provider.

### Example: Authorization Code Flow

[](#example-authorization-code-flow)

```
$provider = new Compwright\OAuth2_Quickbooks_Online\Provider([
    'clientId'      => '{quickbooks-online-client-id}',
    'clientSecret'  => '{quickbooks-online-client-secret}',
    'redirectUri'   => 'https://example.com/callback-url'
]);

if (!isset($_GET['code'])) {
    // If we don't have an authorization code then get one
    $authUrl = $provider->getAuthorizationUrl();
    $_SESSION['oauth2state'] = $provider->getState();
    header('Location: ' . $authUrl);
    exit;
}

// Check given state against previously stored one to mitigate CSRF attack
if (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {
    unset($_SESSION['oauth2state']);
    exit('Invalid state');
}

// Get an access token using the authorization code grant
$token = $provider->getAccessToken('authorization_code', [
    'code' => $_GET['code'],
    'state' => $_GET['state'],
    'realmId' => $_GET['realmId'], // required for getResourceOwner() to work
]);

// You can look up a users profile data
$user = $provider->getResourceOwner($token);
printf('Hello %s!', $user->getId());

// Use the token to interact with an API on the users behalf
echo $token->getToken();
```

Testing
-------

[](#testing)

```
$ make test
```

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

[](#contributing)

Please see [CONTRIBUTING](https://github.com/compwright/oauth2-quickbooks-online/blob/master/CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

This package was forked from [chadhutchins/oauth2-quickbooks](https://github.com/chadhutchins/oauth2-quickbooks), which appeared to be abandoned as of December 2023.

- [Jonathon Hill](https://github.com/compwright)
- [All Contributors](https://github.com/compwright/oauth2-quickbooks-online/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/compwright/oauth2-quickbooks-online/blob/master/LICENSE) for more information.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance73

Regular maintenance activity

Popularity26

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

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

Total

3

Last Release

153d ago

Major Versions

v1.0.1 → v2.0.02025-12-16

PHP version history (2 changes)v1.0.0PHP ^7.4 || ^8

v2.0.0PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/138688?v=4)[Jonathon Hill](/maintainers/compwright)[@compwright](https://github.com/compwright)

---

Tags

oauth2-clientquickbooks-onlineclientleagueoauthoauth2authorizationquickbooksintuitthephpleagueleaguephp

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/compwright-oauth2-quickbooks-online/health.svg)

```
[![Health](https://phpackages.com/badges/compwright-oauth2-quickbooks-online/health.svg)](https://phpackages.com/packages/compwright-oauth2-quickbooks-online)
```

###  Alternatives

[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

42121.2M118](/packages/league-oauth2-google)[thenetworg/oauth2-azure

Azure Active Directory OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2509.6M48](/packages/thenetworg-oauth2-azure)[stevenmaguire/oauth2-keycloak

Keycloak OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2275.9M27](/packages/stevenmaguire-oauth2-keycloak)[patrickbussmann/oauth2-apple

Sign in with Apple OAuth 2.0 Client Provider for The PHP League OAuth2-Client

1132.5M6](/packages/patrickbussmann-oauth2-apple)[mollie/oauth2-mollie-php

Mollie Provider for OAuth 2.0 Client

251.7M1](/packages/mollie-oauth2-mollie-php)[omines/oauth2-gitlab

GitLab OAuth 2.0 Client Provider for The PHP League OAuth2-Client

36721.5k13](/packages/omines-oauth2-gitlab)

PHPackages © 2026

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