PHPackages                             springboardvr/oauth2-square - 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. springboardvr/oauth2-square

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

springboardvr/oauth2-square
===========================

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

v2.0.0(2y ago)16.2k↓11.8%1MITPHPPHP &gt;=5.4.0

Since Feb 23Pushed 2y ago2 watchersCompare

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

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

Square Provider for OAuth 2.0 Client
====================================

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

[![Build Status](https://camo.githubusercontent.com/e592f7a7126bbed33d06ce91e3ea675a424f955c118d4970cb234588253a6d29/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7768656e69776f726b2f6f61757468322d7371756172652e737667)](https://travis-ci.org/wheniwork/oauth2-square)[![Code Coverage](https://camo.githubusercontent.com/543be2adcbedffd1f41f2aafb5a8cce6b759ad97c6df4b24b407a7d6837d4a28/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f7768656e69776f726b2f6f61757468322d7371756172652e737667)](https://coveralls.io/r/wheniwork/oauth2-square)[![Code Quality](https://camo.githubusercontent.com/1e4d562796e472e1534ed515190e7e6d422055284a59131a8960da6f8e82a647/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7768656e69776f726b2f6f61757468322d7371756172652e737667)](https://scrutinizer-ci.com/g/wheniwork/oauth2-square/)[![License](https://camo.githubusercontent.com/ee0b7498e5264a470e65077dc723d3f1f1c16dbddec561cf6cb7f850bbab1c09/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7768656e69776f726b2f6f61757468322d7371756172652e737667)](https://github.com/wheniwork/oauth2-square/blob/master/LICENSE)[![Latest Stable Version](https://camo.githubusercontent.com/4ce6a1d7fa45c99c8e73218b28e4f3cf87d14dc0ed7bd7fc7d8f4e66d22f49ed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7768656e69776f726b2f6f61757468322d7371756172652e737667)](https://packagist.org/packages/wheniwork/oauth2-square)

This package provides Square 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 wheniwork/oauth2-square

```

Usage
-----

[](#usage)

Usage is the same as The League's OAuth client, using `Wheniwork\OAuth2\Client\Provider\Square` as the provider.

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new Wheniwork\OAuth2\Client\Provider\Square([
    'clientId'          => '{square-client-id}',
    'clientSecret'      => '{square-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->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']
    ]);

    // Optional: Now you have a token you can look up a users profile data
    try {

        // We got an access token, let's now get the user's details
        $userDetails = $provider->getUserDetails($token);

        // Use these details to create a new profile
        printf('Hello %s!', $userDetails->firstName);

    } catch (Exception $e) {

        // Failed to get user details
        exit('Oh dear...');
    }

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

###  Health Score

37

—

LowBetter than 82% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 69.2% 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 ~239 days

Recently: every ~808 days

Total

15

Last Release

747d ago

Major Versions

v0.2.0 → v1.0.02015-02-24

v1.2.4 → v2.0.0-beta12015-08-05

1.3.1 → v2.0.02024-04-22

### Community

Maintainers

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

---

Top Contributors

[![shadowhand](https://avatars.githubusercontent.com/u/38203?v=4)](https://github.com/shadowhand "shadowhand (27 commits)")[![MatthewHallCom](https://avatars.githubusercontent.com/u/1230091?v=4)](https://github.com/MatthewHallCom "MatthewHallCom (10 commits)")[![ameech](https://avatars.githubusercontent.com/u/831646?v=4)](https://github.com/ameech "ameech (1 commits)")[![lkvitsinadze](https://avatars.githubusercontent.com/u/12966132?v=4)](https://github.com/lkvitsinadze "lkvitsinadze (1 commits)")

---

Tags

clientoauthoauth2authorizationauthorisationsquare

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/springboardvr-oauth2-square/health.svg)

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

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