PHPackages                             nyan02/kphp\_oauth2\_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. nyan02/kphp\_oauth2\_client

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

nyan02/kphp\_oauth2\_client
===========================

OAuth 2.0 Client Library for KPHP

1.0.0(3y ago)0272MITPHPPHP &gt;=7.4

Since Mar 14Pushed 3y ago1 watchersCompare

[ Source](https://github.com/catnyan02/kphp_oauth2_client)[ Packagist](https://packagist.org/packages/nyan02/kphp_oauth2_client)[ RSS](/packages/nyan02-kphp-oauth2-client/feed)WikiDiscussions master Synced 1mo ago

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

This package provides OAuth 2.0 client support for the KPHP

### Installation

[](#installation)

To install, use composer:

`composer require nyan02/kphp_oauth2_client`

### Usage

[](#usage)

This package implements Generic Provider. However, it is better to use specific providers. There are currently 2 supported providers:

- google (nyan02/kphp\_oauth2\_google)
- keycloak (nyan02/kphp\_oauth2\_keycloak)

This package implements Abstract Provider, that can be used to create new packages for other providers. Generally, to write a new provider you need to implement a new Provider/YourProvider.php by inheriting from Abstract provider, a Provider/YourResourceOwner.php by implementing ResourceOwnerInterface and a new AuthorizationParameters/YourAuthorizationParameters by implementing AuthorizationParametersInterface

You can find simple example on how to implement a new provider in source code for nyan02/kphp\_oauth2\_google. Usually you won't need to change much, just to account for specifics of a certain provider.

This framework allows to use the same flow for all the providers that inherit from this package. The only step that differs between providers is configuring a provider.

### Authorization Code Flow

[](#authorization-code-flow)

After configuring provider we want to get Authorization Code. We use method getAuthorizationParameters() to get parameters from the provider including permission scopes and other info needed for generating AuthorizationUrl.

Next we generate AuthorizationUrl using method getAuthorizationUrl($params) and passing parameters we've got before. Now that we have the Url we can redirect the user to Authorization page of provider.

Once we've got Authorization Code we create a placeholder class for it

`new AuthorizationCode($provider->getClientId(), $provider->getClientSecret(), $provider->getRedirectUri())`

And pass it to getAccessToken method together with the code we've got.

`$token = $provider->getAccessToken($grant, ['code' => $_GET['code']]);`

Now we have the Access Token to Resource.

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity44

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

1151d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f71f0652b08c89dac9f1cb5ff9cca79888c3a4b58ab5fa266328ad5b4d9420b0?d=identicon)[nyan02](/maintainers/nyan02)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/nyan02-kphp-oauth2-client/health.svg)

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

###  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.2M117](/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)
