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

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

anytech/oauth2-vend
===================

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

01.3kPHP

Since Jul 14Pushed 10mo agoCompare

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

READMEChangelogDependenciesVersions (1)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 anytech/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

19

—

LowBetter than 10% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity14

Early-stage or recently created project

 Bus Factor1

Top contributor holds 65% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5088b2c0269fdffb8151099324097ff383178dc2df03a6016c719822be478656?d=identicon)[Anytech](/maintainers/Anytech)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

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

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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