PHPackages                             yaquawa/laravel-passport-binary-uuid-adapter - 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. yaquawa/laravel-passport-binary-uuid-adapter

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

yaquawa/laravel-passport-binary-uuid-adapter
============================================

This package enables Laravel Passport to utilize binary UUID.

v1.0.4(7y ago)53564[3 issues](https://github.com/yaquawa/laravel-passport-binary-uuid-adapter/issues)MITPHPPHP &gt;=7.1.3

Since Aug 29Pushed 7y ago2 watchersCompare

[ Source](https://github.com/yaquawa/laravel-passport-binary-uuid-adapter)[ Packagist](https://packagist.org/packages/yaquawa/laravel-passport-binary-uuid-adapter)[ Docs](https://github.com/yaquawa/laravel-passport-binary-uuid-adapter)[ RSS](/packages/yaquawa-laravel-passport-binary-uuid-adapter/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (2)Versions (6)Used By (0)

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

[](#introduction)

By default [Passport](https://laravel.com/docs/master/passport) does not support using binary UUID.

This package acts as an adapter to allow Passport to be able to use binary UUID.

**Notice:** this package assumes you are using [ramsey/uuid](https://github.com/ramsey/uuid) to generate UUID.

Usage
-----

[](#usage)

First, pull in the package through Composer.

```
composer require yaquawa/laravel-passport-binary-uuid-adapter
```

This package is going to bind some classes of Passport before Passport `make` them.

So to make it works, this package must be loaded before Passport's service provider.

To guarantee this package's service provider to be loaded before Passport's service provider, in the `extra` section of your application's `composer.json` file, add passport to the `dont-discover` list.

```
"extra": {
    "laravel": {
        "dont-discover": [
            "laravel/passport"
        ]
    }
}

```

Then manually add `Laravel\Passport\PassportServiceProvider::class` to `providers` in `config/app.php`.

Lastly, change your user provider to `eloquent_with_binary_uuid` in your `config/auth.php`.

```
'providers' => [
    'users' => [
        'driver' => 'eloquent_with_binary_uuid',
        'model'  => App\Models\User::class,
    ]
]

```

Furthermore, you can specify an array with `model`, in that case, the user provider will attempt to retrieve the user from different tables. This is useful when you want to use the same endpoint for a variety of users. For example, if you give both `User` and `Admin` model class to the `model` key, it'll first try to find a `User` from its table, if it can't then try to find one from `Admin` 's table using the same user credentials from the incoming request.

Exception Handling
------------------

[](#exception-handling)

Also, you should override the `context` method of `Illuminate\Foundation\Exceptions\Handler` in your `App\Exceptions\Handler` class. So the `userId` can be outputted as a normal UUID.

```
namespace App\Exceptions;

use Exception;
use Illuminate\Support\Facades\Auth;
use Yaquawa\Laravel\PassportBinaryUuidAdapter\Helper;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
{
    /**
     * Get the default context variables for logging.
     *
     * @return array
     */
    protected function context()
    {
        try {
            $userId = Auth::id();

            if ($userId) {
                $userId = Helper::decodeUuid($userId);
            }

            return array_filter([
                'userId' => $userId,
                'email'  => Auth::user() ? Auth::user()->email : null,
            ]);
        } catch (Throwable $e) {
            return [];
        }
    }
}
```

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

[](#contributing)

I'm not sure if Laravel is going to allow us to use binary UUID in the future. So I'll try to align this package to the latest version of Laravel and Passport as soon as I can. Please if you discover any issues, feel free to send me a PR 🤝.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance8

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

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

Total

5

Last Release

2772d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

laravelverification

### Embed Badge

![Health badge](/badges/yaquawa-laravel-passport-binary-uuid-adapter/health.svg)

```
[![Health](https://phpackages.com/badges/yaquawa-laravel-passport-binary-uuid-adapter/health.svg)](https://phpackages.com/packages/yaquawa-laravel-passport-binary-uuid-adapter)
```

###  Alternatives

[directorytree/ldaprecord-laravel

LDAP Authentication &amp; Management for Laravel.

5682.0M15](/packages/directorytree-ldaprecord-laravel)[corbosman/laravel-passport-claims

Add claims to Laravel Passport JWT Tokens

88655.9k](/packages/corbosman-laravel-passport-claims)[rinvex/laravel-authy

Rinvex Authy is a simple wrapper for Authy TOTP, the best rated Two-Factor Authentication service for consumers, simplest 2fa Rest API for developers and a strong authentication platform for the enterprise.

3376.7k1](/packages/rinvex-laravel-authy)

PHPackages © 2026

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