PHPackages                             stayallive/laravel-passport-memoized - 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. stayallive/laravel-passport-memoized

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

stayallive/laravel-passport-memoized
====================================

Laravel Passport memoized repositories.

v1.0.6(1y ago)2514.1k↓47.7%12MITPHPPHP ^8.0.2

Since Mar 30Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/stayallive/laravel-passport-memoized)[ Packagist](https://packagist.org/packages/stayallive/laravel-passport-memoized)[ Docs](https://github.com/stayallive/laravel-passport-memoized)[ GitHub Sponsors](https://github.com/stayallive)[ RSS](/packages/stayallive-laravel-passport-memoized/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (6)Versions (8)Used By (2)

Laravel Passport Memoized
=========================

[](#laravel-passport-memoized)

[![Latest Version](https://camo.githubusercontent.com/e217ef36338c0721476703a3eb39f160e12752e4541b0e4e65a97fa425649064/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f73746179616c6c6976652f6c61726176656c2d70617373706f72742d6d656d6f697a65642e7376673f7374796c653d666c61742d737175617265)](https://github.com/stayallive/laravel-passport-memoized/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/ec511e2127c33b315d5eadf36a855c10e03162b53f073a5ec0482561cdf47b98/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73746179616c6c6976652f6c61726176656c2d70617373706f72742d6d656d6f697a65642f63692e79616d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://github.com/stayallive/laravel-passport-memoized/actions/workflows/ci.yaml)[![Total Downloads](https://camo.githubusercontent.com/567748d69cf9fdb376879e719b6fe01471cd28575fe47d40220252c6b4e56cee/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73746179616c6c6976652f6c61726176656c2d70617373706f72742d6d656d6f697a65642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stayallive/laravel-passport-memoized)

Note

This package was only needed for Passport &lt; 13, they have since fixed this performance in the package itself so this package is no longer maintained. You can still use this package for Passport 10-12 or upgrade to Passport 13+

[Laravel Passport](https://github.com/laravel/passport) comes with repositories for the underlying [oauth2-server](https://github.com/thephpleague/oauth2-server) that result in multiple queries to retrieve the same exact object from the database in a single request. With a good database engine this will have a small impact in the range of milliseconds but this is still unacceptable and should be avoided if possible.

With a typical Passport token authenticated request you will see that the token is retrieved 3 times and the client is retrieved twice.

This might be patched in future [Laravel Passport](https://github.com/laravel/passport) releases, but until that time you can install this package.

This package replaces the client and token repositories with ones that memoize the results of certain calls that perform database queries to remove the duplicate queries.

It's safe to use with [Laravel Octane](https://github.com/laravel/octane) since we make sure that the memoize cache is cleared after each request to prevent stale caches.

Why a package?
--------------

[](#why-a-package)

And not a PR to [Laravel Passport](https://github.com/laravel/passport)? This was [attempted](https://github.com/laravel/passport/pull/1433) (although not a perfect solution yet) in the past but it was decided to not be changed so this package was created as an alternative. See also [this](https://github.com/laravel/passport/issues/382) pinned issue for more information and [another package](https://github.com/overtrue/laravel-passport-cache-token) if you are looking for an alternative solution.

Installation
------------

[](#installation)

```
composer require stayallive/laravel-passport-memoized
```

Usage
-----

[](#usage)

You should only have to install this package to benefit, unless you have disable package auto discovery, in that case you will need to add the service provider to your `config/app.php` manually.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover a security vulnerability within this package, please send an e-mail to Alex Bouma at `alex+security@bouma.me`. All security vulnerabilities will be swiftly addressed.

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance65

Regular maintenance activity

Popularity34

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity58

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

Every ~177 days

Recently: every ~218 days

Total

7

Last Release

446d ago

PHP version history (2 changes)v1.0.0PHP ^8.1

v1.0.1PHP ^8.0.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1090754?v=4)[Alex Bouma](/maintainers/stayallive)[@stayallive](https://github.com/stayallive)

---

Top Contributors

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

---

Tags

laravel-packagelaravel-passportlaravelpassportmemoized

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/stayallive-laravel-passport-memoized/health.svg)

```
[![Health](https://phpackages.com/badges/stayallive-laravel-passport-memoized/health.svg)](https://phpackages.com/packages/stayallive-laravel-passport-memoized)
```

###  Alternatives

[jeremy379/laravel-openid-connect

OpenID Connect support to the PHP League's OAuth2 Server. Compatible with Laravel Passport.

55342.3k2](/packages/jeremy379-laravel-openid-connect)[corbosman/laravel-passport-claims

Add claims to Laravel Passport JWT Tokens

88655.9k](/packages/corbosman-laravel-passport-claims)[danjdewhurst/laravel-passport-facebook-login

Facebook Token Request Grant for Laravel Passport

2824.4k](/packages/danjdewhurst-laravel-passport-facebook-login)[mikemclin/passport-custom-request-grant

Custom Request Grant for Laravel Passport

343.6k](/packages/mikemclin-passport-custom-request-grant)

PHPackages © 2026

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