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

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

ursuleacv/oauth2-vend
=====================

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

v1.0.3(6y ago)28.7k↑566.7%MITPHPPHP &gt;=5.6.0

Since Apr 24Pushed 6y ago1 watchersCompare

[ Source](https://github.com/ursuleacv/oauth2-vend)[ Packagist](https://packagist.org/packages/ursuleacv/oauth2-vend)[ RSS](/packages/ursuleacv-oauth2-vend/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (4)Dependencies (4)Versions (5)Used By (0)

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

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

[![Build Status](https://camo.githubusercontent.com/1aa068d1dbcec47bd0286284e3d2d0b4ce5f66f74d5c53efbe01796c604bbf6d/68747470733a2f2f7472617669732d63692e6f72672f757273756c656163762f6f61757468322d76656e642e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/ursuleacv/oauth2-vend)

This package provides Vend OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).

This package is compliant with [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md), [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md), [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md), and [PSR-7](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-7-http-message.md). If you notice compliance oversights, please send a patch via pull request.

Requirements
------------

[](#requirements)

The following versions of PHP are supported.

- PHP 7.0
- PHP 7.1
- PHP 7.2
- HHVM

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

[](#installation)

Add the following to your `composer.json` file.

```
{
    "require": {
        "ursuleacv/oauth2-vend": "~1.0"
    }
}
```

Usage
-----

[](#usage)

### Authorization Code Flow

[](#authorization-code-flow)

```
session_start();

$provider = new League\OAuth2\Client\Provider\Vend([
    'clientId' => CLIENT_ID,
    'clientSecret' => CLIENT_SECRET,
    'redirectUri' => REDIRECT_URI,
    'storeName' => STORE_NAME,
]);

if (!isset($_GET['code'])) {

    // If we don't have an authorization code then get one
    $authUrl = $provider->getAuthorizationUrl([]);
    $_SESSION['oauth2state'] = $provider->getState();

    echo 'Log in with Vend!';
    exit;

// Check given state against previously stored one to mitigate CSRF attack
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {

    unset($_SESSION['oauth2state']);
    echo 'Invalid state.';
    exit;

}

// Try to get an access token (using the authorization code grant)
$token = $provider->getAccessToken('authorization_code', [
    'code' => $_GET['code']
]);

try {

    // We got an access token, let's make some requests
    $vendApi = $provider->vendApi($token);
    $sale = $vendApi->getSale(1);
    $registers = $vendApi->getRegisters();

    echo '';
    print_r($sale);
    echo '';

} catch (Exception $e) {
    exit($e->getMessage());
}

echo '';
// Use this to interact with the API on the client behalf
var_dump($token->getToken());

echo '';
```

Testing
-------

[](#testing)

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

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/ursuleacv/oauth2-vend/blob/master/CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Valentin Ursuleac](https://github.com/ursuleacv)
- [brucealdridge](https://github.com/brucealdridge/VendAPI) - original library

License
-------

[](#license)

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

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 76.9% 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 ~404 days

Total

4

Last Release

2510d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.5.0

v1.0.3PHP &gt;=5.6.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1458222?v=4)[Valentin Ursuleac](/maintainers/ursuleacv)[@ursuleacv](https://github.com/ursuleacv)

---

Top Contributors

[![ursuleacv](https://avatars.githubusercontent.com/u/1458222?v=4)](https://github.com/ursuleacv "ursuleacv (10 commits)")[![kangaroo-val](https://avatars.githubusercontent.com/u/22823136?v=4)](https://github.com/kangaroo-val "kangaroo-val (3 commits)")

---

Tags

oauth2oauth2-clientphpphp7vend-posclientAuthenticationoauthoauth2authorizationvend

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[league/oauth2-google

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

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

Azure Active Directory OAuth 2.0 Client Provider for The PHP League OAuth2-Client

25310.7M83](/packages/thenetworg-oauth2-azure)[cakedc/oauth2-cognito

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

18623.5k](/packages/cakedc-oauth2-cognito)

PHPackages © 2026

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