PHPackages                             gtcrais/laravel-persona - 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. gtcrais/laravel-persona

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

gtcrais/laravel-persona
=======================

v1.0.0(11mo ago)00MITPHPPHP ^8.2

Since May 23Pushed 11mo agoCompare

[ Source](https://github.com/GTCrais/laravel-persona)[ Packagist](https://packagist.org/packages/gtcrais/laravel-persona)[ RSS](/packages/gtcrais-laravel-persona/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Laravel Persona
---------------

[](#laravel-persona)

This is NOT a first-party package. This package adds Visitor and Persona concepts to your Laravel application.

**Requirements:** Tested on Laravel 12. It should work on lower versions as well.

**Note:** Docs could use more information, but I made this package mainly for myself. If you happen to use it, hit me up, and I'll update the docs with better explanations.

---

**Visitor:** Non-registered user which still needs to be tracked and stored into the database. This is achieved using UUID stored in a cookie.

**Persona:** Umbrella model for Users and Visitors. When calling `request()->persona()`, it will return currently logged in `User` if it exists. If not, it will return currently tracked `Visitor` if it exists. If not, it will return `null`.

**Installation:**

- Run `composer require gtcrais/laravel-persona`
- Run `php artisan laravel-persona:install`
- Add `... implements GTCrais\LaravelPersona\Models\Contracts\Persona` Contract to your `User` model
- Add `use GTCrais\LaravelPersona\Models\Concerns\UserPersona` Concern to your `User` model
- Migrate the database
- Register middleware:

```
use App\Http\Middleware\AuthPersona;
use App\Http\Middleware\EnsurePersonaExists;
use App\Http\Middleware\ResolvePersona;

$middleware->appendToGroup('web', [ResolvePersona::class]);
$middleware->appendToGroup('api', [ResolvePersona::class]);
$middleware->alias(['ensurePersonaExists' => EnsurePersonaExists::class]);
$middleware->alias(['authPersona' => AuthPersona::class]);

```

- Upon successful login:

```
use App\Http\Middleware\Concerns\InteractsWithVisitor;

...

if ($visitor = auth()->guard('web')->user()->visitor) {
    $this->setVisitorUuidCookie($visitor->uuid);
    $this->injectVisitorData(request(), $visitor);
}

```

- Upon successful registration:

```
use App\Http\Middleware\Concerns\InteractsWithVisitor;

...

$visitor = $this->optionallyCreateVisitor();

$this->associateVisitorWithUser($visitor, $user);
$this->injectVisitorData(request(), $visitor);

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance50

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

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

355d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/18f7a834bca30b4b00efcf42852d375cf1a9941c47398b84e764f785adc8aaf7?d=identicon)[GTCrais](/maintainers/GTCrais)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/gtcrais-laravel-persona/health.svg)

```
[![Health](https://phpackages.com/badges/gtcrais-laravel-persona/health.svg)](https://phpackages.com/packages/gtcrais-laravel-persona)
```

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