PHPackages                             payping/oauth2-payping-php-client - 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. payping/oauth2-payping-php-client

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

payping/oauth2-payping-php-client
=================================

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

v1.0.0(6y ago)17171[1 issues](https://github.com/payping/payping-oauth2-php-client/issues)MITPHP

Since Jun 21Pushed 6y ago1 watchersCompare

[ Source](https://github.com/payping/payping-oauth2-php-client)[ Packagist](https://packagist.org/packages/payping/oauth2-payping-php-client)[ RSS](/packages/payping-oauth2-payping-php-client/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Payping Provider for OAuth 2.0 Client
=====================================

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

This package provides Payping 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 payping/oauth2-payping-php-client

```

Usage
-----

[](#usage)

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

### Authorization Code Flow

[](#authorization-code-flow)

```
include "vendor/autoload.php";

 function generateVerified(){
     $random = bin2hex(openssl_random_pseudo_bytes(32));
     $verifier =base64UrlSafeEncode(pack('H*', $random));
     return $verifier;
 }
/**
 * ساخت یک challenge code
 * @param $codeVerifier
 * @return string
 */
 function generateCodeChallenge($codeVerifier)
 {
     return base64UrlSafeEncode(pack('H*', hash('sha256', $codeVerifier)));
 }
/**
 * escape رشته
 * @param $string
 * @return string
 */
 function base64UrlSafeEncode($string)
 {
     return rtrim(strtr(base64_encode($string), '+/', '-_'), '=');
 }

$verifier_code= 'CODE_VERIFIER';

$provider = new PayPing\OAuth2\Client\Provider\PayPing([
    'clientId'          => '{client_id}',
    'clientSecret'      => '{client_secret}',
    'redirectUri'       => '{redirect_url}'
]);
if (!isset($_GET['code'])) {

    // If we don't have an authorization code then get one
    $authUrl = $provider->getAuthorizationUrl([
        'code_challenge'=>generateCodeChallenge($verifier_code),
        'code_challenge_method'=>'S256'
    ]);
    $_SESSION['oauth2state'] = $provider->getState();
    header('Location: '.$authUrl);
    exit;
} else {
    try {
       $accessToken = $provider->getAccessToken('authorization_code', [
           'code' => $_GET['code'],
           'code_verifier' => $verifier_code,
       ]);

        echo 'Access Token: ' . $accessToken->getToken() . "";
        echo 'Refresh Token: ' . $accessToken->getRefreshToken() . "";
        echo 'Expired in: ' . $accessToken->getExpires() . "";
        echo 'Already expired? ' . ($accessToken->hasExpired() ? 'expired' : 'not expired') . "";
    } catch (Exception $e) {
        echo $e->getMessage();
    }
}
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

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

2522d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/90d13e0dde0f6048333440cdfae655cab86cf34981e0953465d7e71c5b7b7d39?d=identicon)[payping](/maintainers/payping)

---

Top Contributors

[![farhad-lotfeali](https://avatars.githubusercontent.com/u/8584058?v=4)](https://github.com/farhad-lotfeali "farhad-lotfeali (9 commits)")

---

Tags

clientoauthoauth2authorizationauthorisationPayPing

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/payping-oauth2-payping-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/payping-oauth2-payping-php-client/health.svg)](https://phpackages.com/packages/payping-oauth2-payping-php-client)
```

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