PHPackages                             tenfef/oauth2-myob - 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. tenfef/oauth2-myob

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

tenfef/oauth2-myob
==================

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

1.01(8y ago)653.7k2[1 issues](https://github.com/tenfef/oauth2-myob/issues)MITPHPPHP &gt;=5.4.0

Since Aug 16Pushed 5y ago2 watchersCompare

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

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

MYOB Provider for OAuth 2.0 Client
==================================

[](#myob-provider-for-oauth-20-client)

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

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

[](#installation)

To install, use composer:

```
composer require 'tenfef/oauth2-myob:dev-master'

```

Usage
-----

[](#usage)

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

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new Tenfef\MYOB\Provider([
    'clientId'     => '{myob-client-id}',
    'clientSecret' => '{myob-client-secret}',
    'domainPrefix' => '{myob-domain-prefix}',
    '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->state;
    header('Location: '.$authUrl);
    exit;

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

    unset($_SESSION['oauth2state']);
    exit('Invalid state');

} else {

    // Try to get an access token (using the authorization code grant)
    $token = $provider->getAccessToken('authorization_code', [
        'code' => $_GET['code']
    ]);

    // Use this to interact with an API on the users behalf
    echo $token->accessToken;
}
```

Refreshing a Token
------------------

[](#refreshing-a-token)

```
$provider = new Tenfef\MYOB\Provider([
    'clientId'     => '{myob-client-id}',
    'clientSecret' => '{myob-client-secret}',
    'domainPrefix' => '{myob-domain-prefix}',
    'redirectUri'  => 'https://example.com/callback-url'
]);

$grant = new \League\OAuth2\Client\Grant\RefreshToken();
$token = $provider->getAccessToken($grant, ['refresh_token' => $refreshToken]);
```

Fetching company files from Account Right
-----------------------------------------

[](#fetching-company-files-from-account-right)

```
    $provider = new Tenfef\MYOB\Provider([
		'clientId'      => 'xxxxxxxxx',
		'clientSecret'  => 'xxxxxxxxx',
		'redirectUri'   => 'https://example.com',
		'scopes'        => ['la.global CompanyFile']
	]);

	$token = 'xxxxxxxxx';

	$request = new Tenfef\MYOB\AccountRight($provider, $token);
	echo json_encode($request->companyFiles());
```

Hat tip to the Vend OAuth Provider which gave a good template for this Provider.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.9% 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 ~1105 days

Total

2

Last Release

2093d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e2b1d43282fc1ae974d0018b39f990788b7d5ceb2a0e65590901e70c7c14e876?d=identicon)[tenfef](/maintainers/tenfef)

---

Top Contributors

[![tenfef](https://avatars.githubusercontent.com/u/1075450?v=4)](https://github.com/tenfef "tenfef (26 commits)")[![cedw032](https://avatars.githubusercontent.com/u/5538701?v=4)](https://github.com/cedw032 "cedw032 (2 commits)")

---

Tags

clientoauthoauth2authorizationauthorisationmyob

### Embed Badge

![Health badge](/badges/tenfef-oauth2-myob/health.svg)

```
[![Health](https://phpackages.com/badges/tenfef-oauth2-myob/health.svg)](https://phpackages.com/packages/tenfef-oauth2-myob)
```

###  Alternatives

[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)
