PHPackages                             wheniwork/oauth2-clover - 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. wheniwork/oauth2-clover

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

wheniwork/oauth2-clover
=======================

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

v0.2.0(11y ago)41114[1 PRs](https://github.com/wheniwork/oauth2-clover/pulls)MITPHPPHP &gt;=5.4.0

Since May 27Pushed 10y ago5 watchersCompare

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

READMEChangelogDependencies (3)Versions (5)Used By (0)

Clover Provider for OAuth 2.0 Client
====================================

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

[![Build Status](https://camo.githubusercontent.com/7677013c279e029e04c49e2e888d2a763dfe8ed1d5c35abb5f07fcad79d117a3/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7768656e69776f726b2f6f61757468322d636c6f7665722e737667)](https://travis-ci.org/wheniwork/oauth2-clover)[![Code Coverage](https://camo.githubusercontent.com/e964b5dfed55ce9337717d86c1a4a796a53e0fc72e22b1ac1647c0a584bdb475/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f7768656e69776f726b2f6f61757468322d636c6f7665722e737667)](https://coveralls.io/r/wheniwork/oauth2-clover)[![Code Quality](https://camo.githubusercontent.com/ca7a6d8d8a29d5edb37a9259acfe5634d89640fec9cb5ab5f9db211507aca14b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7768656e69776f726b2f6f61757468322d636c6f7665722e737667)](https://scrutinizer-ci.com/g/wheniwork/oauth2-clover/)[![License](https://camo.githubusercontent.com/3a69b49ec965acd49fb5cc39150e24aee6e2f61703546c672d9300dbe8fbf8cc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7768656e69776f726b2f6f61757468322d636c6f7665722e737667)](https://github.com/wheniwork/oauth2-clover/blob/master/LICENSE)[![Latest Stable Version](https://camo.githubusercontent.com/d89a52a031835786e1f54684ea04be13bfad0b8566565f2c65c7886534185fc8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7768656e69776f726b2f6f61757468322d636c6f7665722e737667)](https://packagist.org/packages/wheniwork/oauth2-clover)

This package provides [Clover OAuth 2.0](https://demo1.dev.clover.com/docs/oauth) 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-clover

```

Usage
-----

[](#usage)

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

### Authorization Code Flow

[](#authorization-code-flow)

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

    // 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->name);

    } 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;

}
```

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

[](#refreshing-a-token)

Clover does not use refresh tokens.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 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

Every ~6 days

Total

3

Last Release

4018d ago

### Community

Maintainers

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

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

---

Top Contributors

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

---

Tags

clientoauthoauth2authorizationauthorisationclover

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wheniwork-oauth2-clover/health.svg)

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

###  Alternatives

[stevenmaguire/oauth2-keycloak

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

2276.2M36](/packages/stevenmaguire-oauth2-keycloak)[patrickbussmann/oauth2-apple

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

1142.7M10](/packages/patrickbussmann-oauth2-apple)[omines/oauth2-gitlab

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

36761.9k15](/packages/omines-oauth2-gitlab)[league/oauth2-instagram

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

661.1M43](/packages/league-oauth2-instagram)[mollie/oauth2-mollie-php

Mollie Provider for OAuth 2.0 Client

251.8M1](/packages/mollie-oauth2-mollie-php)[dalpras/oauth2-gotowebinar

LogMeIn GoToWebinar OAuth 2.0 Client Provider for the PHP League's OAuth 2.0 Client

1245.5k](/packages/dalpras-oauth2-gotowebinar)

PHPackages © 2026

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