PHPackages                             stevenmaguire/oauth2-paypal - 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. stevenmaguire/oauth2-paypal

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

stevenmaguire/oauth2-paypal
===========================

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

2.0.0(9y ago)7206.4k—8.5%2MITPHP

Since Sep 24Pushed 9y ago3 watchersCompare

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

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

Paypal Provider for OAuth 2.0 Client
====================================

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

[![Latest Version](https://camo.githubusercontent.com/9d95f78f7e2226fb263271cf2c65c3b856f2fa5cd78cbdab55ee1bcb840bd3e1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f73746576656e6d6167756972652f6f61757468322d70617970616c2e7376673f7374796c653d666c61742d737175617265)](https://github.com/stevenmaguire/oauth2-paypal/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/e289e498b6d5763ee31722325ae728a39fbbaf802c05e738a7a48dc45f9691f6/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f73746576656e6d6167756972652f6f61757468322d70617970616c2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/stevenmaguire/oauth2-paypal)[![Coverage Status](https://camo.githubusercontent.com/2f04e30870a2221452dfc1df1e175caf8cb15fa992f62dc9f0d07145fc3c58fb/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f73746576656e6d6167756972652f6f61757468322d70617970616c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/stevenmaguire/oauth2-paypal/code-structure)[![Quality Score](https://camo.githubusercontent.com/530492975701276538d052b7914e37cca5d46dc57896f3182c59e6b82c010524/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f73746576656e6d6167756972652f6f61757468322d70617970616c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/stevenmaguire/oauth2-paypal)[![Total Downloads](https://camo.githubusercontent.com/608a826f91b405ffea8b34f3a395aae015c15ee62559182b820b122a094fd174/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73746576656e6d6167756972652f6f61757468322d70617970616c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stevenmaguire/oauth2-paypal)

This package provides Paypal 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 stevenmaguire/oauth2-paypal

```

Usage
-----

[](#usage)

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

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new Stevenmaguire\OAuth2\Client\Provider\Paypal([
    'clientId'          => '{paypal-client-id}',
    'clientSecret'      => '{paypal-client-secret}',
    'redirectUri'       => 'https://example.com/callback-url',
    'isSandbox'         => true, // Optional, defaults to false. When true, client uses sandbox urls.
]);
```

For further usage of this package please refer to the [core package documentation on "Authorization Code Grant"](https://github.com/thephpleague/oauth2-client#usage).

#### Managing scopes with your authorization request

[](#managing-scopes-with-your-authorization-request)

```
$options = [
    'scope' => ['openid', 'profile', 'email', 'phone', 'address']
];

$authorizationUrl = $provider->getAuthorizationUrl($options);
```

> The value passed must always include `openid` at minimum

You can review a [full list of scopes](https://developer.paypal.com/docs/integration/direct/identity/attributes/) on PayPal's website.

### Refreshing a Token

[](#refreshing-a-token)

```
$provider = new Stevenmaguire\OAuth2\Client\Provider\Paypal([
    'clientId'          => '{paypal-client-id}',
    'clientSecret'      => '{paypal-client-secret}',
    'redirectUri'       => 'https://example.com/callback-url'
]);

$existingAccessToken = getAccessTokenFromYourDataStore();

if ($existingAccessToken->hasExpired()) {
    $newAccessToken = $provider->getAccessToken('refresh_token', [
        'refresh_token' => $existingAccessToken->getRefreshToken()
    ]);

    // Purge old access token and store new access token to your data store.
}
```

For further usage of this package please refer to the [core package documentation on "Refreshing a Token"](https://github.com/thephpleague/oauth2-client#refreshing-a-token).

Testing
-------

[](#testing)

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

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Steven Maguire](https://github.com/stevenmaguire)
- [All Contributors](https://github.com/stevenmaguire/oauth2-paypal/contributors)

License
-------

[](#license)

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

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community10

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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 ~245 days

Total

3

Last Release

3400d ago

Major Versions

0.1.0 → 1.x-dev2015-09-24

1.x-dev → 2.0.02017-01-26

### Community

Maintainers

![](https://www.gravatar.com/avatar/8d9c05a30823ae19fc54aa4b4721a696c253f8dec10c7fd22d372cfdc0fcb36d?d=identicon)[stevenmaguire](/maintainers/stevenmaguire)

---

Top Contributors

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

---

Tags

clientoauthoauth2authorizationauthorisationpaypal

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/stevenmaguire-oauth2-paypal/health.svg)

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

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