PHPackages                             hanbz/passport-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. hanbz/passport-client

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

hanbz/passport-client
=====================

Laravel wrapper around passport client OAuth2 libraries.

v1.0.1(5y ago)212.0k2MITPHPPHP ^7.2|^8.0

Since Nov 12Pushed 5y ago1 watchersCompare

[ Source](https://github.com/hanbz/passport-oauth2-client)[ Packagist](https://packagist.org/packages/hanbz/passport-client)[ RSS](/packages/hanbz-passport-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (8)Versions (3)Used By (0)

Laravel passport client
=======================

[](#laravel-passport-client)

[![Total Downloads](https://camo.githubusercontent.com/8f4fa6a2053a7854faffeac93a8ced914d28283d10f580a687d61b3f126d867d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f68616e627a2f70617373706f72742d636c69656e74)](https://packagist.org/packages/hanbz/passport-client)[![Latest Stable Version](https://camo.githubusercontent.com/7433ba9f6799028956f824e94d35778b0242a4418e786a26cd8cdb114c194ce3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f68616e627a2f70617373706f72742d636c69656e74)](https://packagist.org/packages/hanbz/passport-client)[![License](https://camo.githubusercontent.com/57e2067d11baa0d6e1ceb4c85ab919c15cb8947738892517bcec5d4641918e17/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f68616e627a2f70617373706f72742d636c69656e74)](https://packagist.org/packages/hanbz/passport-client)

Introduction
------------

[](#introduction)

Fork from Laravel Socialite to build a Laravel passport client library to OAuth2.0 authentication with [Laravel port](https://github.com/laravel/passport).

Install
-------

[](#install)

```
$ composer require hanbz/passport-client

```

add the config at .env

```
CLIENT_ID=oauth_client
CLIENT_SECRET=oauth_secert
REDIRECT=your_callback_url
OAUTH_DOMAIN=your_oauth_server

```

add this section at config/service.php

```
    'passport' => [
        'client_id' => env('CLIENT_ID'),
        'client_secret' => env('CLIENT_SECRET'),
        'redirect' => env('REDIRECT'),
        'domain' => env('OAUTH_DOMAIN')
    ]

```

Usage
-----

[](#usage)

Use the package by Facades name PassportClient. The driver name is passport. It includes two functions redirect and user.

The redirect function will redirect user to the oauth server.

##### web.php

[](#webphp)

```
use App\Http\Controllers\Auth\OAuthController;
use hanbz\PassportClient\Facades\PassportClient;

Route::get('oauth/login', fn() => PassportClient::driver('passport')->redirect())->name('oauth.login');
Route::get('oauth/callback', [OAuthController::class, 'OAuthCallback']);
```

The user function will return the user info.

##### AuthController.php

[](#authcontrollerphp)

```
use App\Models\User;
use hanbz\PassportClient\Facades\PassportClient;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Str;

    public function OAuthCallback()
    {
        $oauth_user = PassportClient::driver('passport')->user();

        $user = User::where('email', $oauth_user->getEmail())->first();

        if (is_null($user)) {
            $name = $oauth_user->getName();
            $email = $oauth_user->getEmail();
            $password = Str::random(8);
            $user = User::create(compact('name', 'email', 'password'));
        }

        Auth::login($user);

        return redirect()->intended('dashboard');
    }
```

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

[](#contributing)

Thank you for considering contributing to Laravel passport client!

Code of Conduct
---------------

[](#code-of-conduct)

In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).

License
-------

[](#license)

Laravel passport client is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 51.6% 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 ~0 days

Total

2

Last Release

2012d ago

### Community

Maintainers

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

---

Top Contributors

[![taylorotwell](https://avatars.githubusercontent.com/u/463230?v=4)](https://github.com/taylorotwell "taylorotwell (279 commits)")[![driesvints](https://avatars.githubusercontent.com/u/594614?v=4)](https://github.com/driesvints "driesvints (103 commits)")[![lucasmichot](https://avatars.githubusercontent.com/u/513603?v=4)](https://github.com/lucasmichot "lucasmichot (37 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (16 commits)")[![adamgoose](https://avatars.githubusercontent.com/u/611068?v=4)](https://github.com/adamgoose "adamgoose (11 commits)")[![777genius](https://avatars.githubusercontent.com/u/13103045?v=4)](https://github.com/777genius "777genius (10 commits)")[![georgecoca](https://avatars.githubusercontent.com/u/6689915?v=4)](https://github.com/georgecoca "georgecoca (8 commits)")[![CupOfTea696](https://avatars.githubusercontent.com/u/7327050?v=4)](https://github.com/CupOfTea696 "CupOfTea696 (6 commits)")[![SammyK](https://avatars.githubusercontent.com/u/578780?v=4)](https://github.com/SammyK "SammyK (5 commits)")[![isaackearl](https://avatars.githubusercontent.com/u/9354830?v=4)](https://github.com/isaackearl "isaackearl (5 commits)")[![barryvdh](https://avatars.githubusercontent.com/u/973269?v=4)](https://github.com/barryvdh "barryvdh (5 commits)")[![teertz](https://avatars.githubusercontent.com/u/9487778?v=4)](https://github.com/teertz "teertz (4 commits)")[![BostjanOb](https://avatars.githubusercontent.com/u/650818?v=4)](https://github.com/BostjanOb "BostjanOb (4 commits)")[![hanbz](https://avatars.githubusercontent.com/u/4588469?v=4)](https://github.com/hanbz "hanbz (4 commits)")[![Max13](https://avatars.githubusercontent.com/u/531249?v=4)](https://github.com/Max13 "Max13 (4 commits)")[![ntzm](https://avatars.githubusercontent.com/u/3888578?v=4)](https://github.com/ntzm "ntzm (4 commits)")[![browner12](https://avatars.githubusercontent.com/u/5232313?v=4)](https://github.com/browner12 "browner12 (4 commits)")[![KerryJones](https://avatars.githubusercontent.com/u/2685411?v=4)](https://github.com/KerryJones "KerryJones (3 commits)")[![alihamze](https://avatars.githubusercontent.com/u/1642068?v=4)](https://github.com/alihamze "alihamze (3 commits)")[![EveryWell](https://avatars.githubusercontent.com/u/4259006?v=4)](https://github.com/EveryWell "EveryWell (3 commits)")

---

Tags

clientlaraveloauth2

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hanbz-passport-client/health.svg)

```
[![Health](https://phpackages.com/badges/hanbz-passport-client/health.svg)](https://phpackages.com/packages/hanbz-passport-client)
```

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k96.9M674](/packages/laravel-socialite)[josiasmontag/laravel-recaptchav3

Recaptcha V3 for Laravel package

2641.6M2](/packages/josiasmontag-laravel-recaptchav3)[rahul900day/laravel-captcha

Different types of Captcha implementation for Laravel Application.

10715.9k](/packages/rahul900day-laravel-captcha)[truckersmp/steam-socialite

Laravel Socialite provider for Steam OpenID.

1516.7k](/packages/truckersmp-steam-socialite)

PHPackages © 2026

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