PHPackages                             thinkerytim/oauth2-flexmls - 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. thinkerytim/oauth2-flexmls

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

thinkerytim/oauth2-flexmls
==========================

FlexMLS OAuth 2.0 support for the PHP League's OAuth 2.0 Client

v0.1-alpha(6y ago)021MITPHPPHP &gt;=7.2CI failing

Since Jun 20Pushed 5y ago1 watchersCompare

[ Source](https://github.com/thinkerytim/oauth2-flexmls)[ Packagist](https://packagist.org/packages/thinkerytim/oauth2-flexmls)[ RSS](/packages/thinkerytim-oauth2-flexmls/feed)WikiDiscussions master Synced today

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

FlexMLS Spark Platform Provider for PHP League OAuth 2.0 Client
===============================================================

[](#flexmls-spark-platform-provider-for-php-league-oauth-20-client)

[![PHP Composer](https://github.com/thinkerytim/oauth2-flexmls/workflows/PHP%20Composer/badge.svg)](https://github.com/thinkerytim/oauth2-flexmls/workflows/PHP%20Composer/badge.svg)

This package provides FlexMLS OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client). Users can authenticate against the FlexMLS Spark Platform () and obtain a token for use with the Spark API or the FlexMLS RESO Web API.

Using these tokens developers can create real estate applications for web, mobile or data replication.

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

[](#installation)

```
composer require thinkerytim/oauth2-flexmls

```

Usage
-----

[](#usage)

```
$flexmlsProvider = new \ThinkeryTim\OAuth2\Client\Provider\FlexMLS([
    'clientId'                => 'yourId',          // The client ID assigned to you by the Spark Platform
    'clientSecret'            => 'yourSecret',      // The client password assigned to you by the Spark Platform
    'redirectUri'             => 'yourRedirectUri'  // The return URL you specified for your app on Spark Platform
]);

// Get authorization code
if (!isset($_GET['code'])) {
    // Options are optional, defaults to 'openid' only
    $options = ['scope' => 'openid'];
    // Get authorization URL
    $authorizationUrl = $flexmlsProvider->getAuthorizationUrl($options);

    // Get state and store it to the session
    $_SESSION['oauth2state'] = $flexmlsProvider->getState();

    // Redirect user to authorization URL
    header('Location: ' . $authorizationUrl);
    exit;
// Check for errors
} elseif (empty($_GET['state']) || (isset($_SESSION['oauth2state']) && $_GET['state'] !== $_SESSION['oauth2state'])) {
    if (isset($_SESSION['oauth2state'])) {
        unset($_SESSION['oauth2state']);
    }
    exit('Invalid state');
} else {
    // Get access token
    try {
        $accessToken = $flexmlsProvider->getAccessToken(
            'authorization_code',
            [
                'code' => $_GET['code']
            ]
        );
    } catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) {
        exit($e->getMessage());
    }

    // Get resource owner
    try {
        $resourceOwner = $flexmlsProvider->getResourceOwner($accessToken);
    } catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) {
        exit($e->getMessage());
    }

    // Now you can store the results to session etc.
    $_SESSION['accessToken'] = $accessToken;
    $_SESSION['resourceOwner'] = $resourceOwner;

    var_dump(
        $resourceOwner->getId(),
        $resourceOwner->getName(),
        $resourceOwner->getPrimaryEmail(),
        $resourceOwner->OfficeMlsId, // this is using the _get magic method
        $resourceOwner->toArray()
    );
}
```

For more information see the PHP League's general usage examples.

Testing
-------

[](#testing)

```
$ ./vendor/bin/phpunit
```

License
-------

[](#license)

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

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

2205d ago

### Community

Maintainers

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

---

Top Contributors

[![thinkerytim](https://avatars.githubusercontent.com/u/122242?v=4)](https://github.com/thinkerytim "thinkerytim (12 commits)")

---

Tags

phpapiclientAuthenticationoauthoauth2authorizationRESOflexmls

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/thinkerytim-oauth2-flexmls/health.svg)

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

###  Alternatives

[league/oauth2-google

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

42223.4M176](/packages/league-oauth2-google)[league/oauth2-facebook

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

32013.9M86](/packages/league-oauth2-facebook)[andalisolutions/oauth2-anaf

Anaf OAuth 2.0 support for the PHP League's OAuth 2.0 Client

196.6k](/packages/andalisolutions-oauth2-anaf)

PHPackages © 2026

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