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

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

wheniwork/oauth2-vend
=====================

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

v0.1.0(11y ago)32.2k2[2 issues](https://github.com/wheniwork/oauth2-vend/issues)MITPHPPHP &gt;=5.4.0

Since May 27Pushed 11y ago6 watchersCompare

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

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

Vend Provider for OAuth 2.0 Client
==================================

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

[![Build Status](https://camo.githubusercontent.com/b2d81d414244ef0653945f3a87e99d11d836381068496d1f8aefacbd61b95b43/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7768656e69776f726b2f6f61757468322d76656e642e737667)](https://travis-ci.org/wheniwork/oauth2-vend)[![Code Coverage](https://camo.githubusercontent.com/77525823b029f2465e609c4af5a1a830e2364bcba8b0d7e93caddc380dab8fa1/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f7768656e69776f726b2f6f61757468322d76656e642e737667)](https://coveralls.io/r/wheniwork/oauth2-vend)[![Code Quality](https://camo.githubusercontent.com/545d74ee50bdae53745b9c313f9e9b59b564d71b19568b15b0bb1cf3b5a4d9b7/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7768656e69776f726b2f6f61757468322d76656e642e737667)](https://scrutinizer-ci.com/g/wheniwork/oauth2-vend/)[![License](https://camo.githubusercontent.com/e54d3647f7124bc9ed89a51ba9899b369833d0f64d3c29e24e1ab7e61454c906/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7768656e69776f726b2f6f61757468322d76656e642e737667)](https://github.com/wheniwork/oauth2-vend/blob/master/LICENSE)[![Latest Stable Version](https://camo.githubusercontent.com/0e47d34e3fb3a324d2a3186eb3156b1496e0de4bc5558772854002a380cbda9b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7768656e69776f726b2f6f61757468322d76656e642e737667)](https://packagist.org/packages/wheniwork/oauth2-vend)

This package provides [Vend OAuth 2.0](https://developers.vendhq.com/documentation/oauth.html) 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-vend

```

Usage
-----

[](#usage)

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

### Authorization Code Flow

[](#authorization-code-flow)

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

    // Vend does not provide a way to get information about the currently
    // authenticated user. (If you know of a way, please let me know!)

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

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

[](#refreshing-a-token)

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

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

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance7

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

4056d 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 (7 commits)")

---

Tags

clientoauthoauth2authorizationauthorisationvend

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[stevenmaguire/oauth2-keycloak

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

2306.4M45](/packages/stevenmaguire-oauth2-keycloak)[patrickbussmann/oauth2-apple

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

1152.8M12](/packages/patrickbussmann-oauth2-apple)[omines/oauth2-gitlab

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

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

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

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

Mollie Provider for OAuth 2.0 Client

261.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

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

PHPackages © 2026

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