eloquent-works / persona
EloquentWorks Persona gives your users elegant public profiles with slugs, bios, avatars, links, visibility, and profile pages.
Requires
- php: ^8.2
- illuminate/contracts: ^11.15|^12.0|^13.0
- illuminate/database: ^11.15|^12.0|^13.0
- illuminate/routing: ^11.15|^12.0|^13.0
- illuminate/support: ^11.15|^12.0|^13.0
Requires (Dev)
- larastan/larastan: ^3.10
- laravel/pint: ^1.18
- nunomaduro/larastan: ^3.0
- orchestra/testbench: ^9.0|^10.0
- phpunit/phpunit: ^11.0
This package is not auto-updated.
Last update: 2026-07-11 20:07:05 UTC
README
Persona
Elegant public profile tools for Laravel applications.
Persona gives your Eloquent user model a clean way to manage public profiles, unique usernames, username change tokens, display names, bios, avatars, banners, social links, custom links, visibility, publishing, and profile view tracking.
$profile = $user->persona; $profile->recordView(); $profile->avatarUrl();
Supported Versions
| Package Version | PHP | Laravel / Illuminate |
|---|---|---|
| Current | ^8.2 |
^11.15 || ^12.0 || ^13.0 |
Composer will automatically resolve compatible Laravel / Illuminate versions based on your project.
Installation
Install the package through Composer:
composer require eloquentworks/persona
Publish the config and migrations:
php artisan persona:install
Run your migrations:
php artisan migrate
Add the trait to your user model
Add HasPersona to your application user model:
<?php namespace App\Models; use EloquentWorks\Persona\Traits\HasPersona; use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable { use HasPersona; }
Features
- Public user profiles
- Slug-based profile URLs
- Unique usernames using the profile slug
- Username change tokens with configurable earning intervals
- Maximum username token balances
- Display names, headlines, bios, and locations
- Avatar and banner support
- Website, social links, and custom links
- Public and private profile visibility
- Published profile controls
- Profile view tracking
- Query scopes for public, published, and visible profiles
- Publishable views
- Configurable model and table names
Basic usage
$profile = $user->persona()->create([ 'slug' => 'john-doe', 'display_name' => 'John Doe', 'headline' => 'Laravel Developer', 'bio' => 'I build Laravel applications and packages.', 'is_public' => true, 'published_at' => now(), ]); $profile->recordView(); $profile->avatarUrl(); $profile->bannerUrl(); $profile->url();
Username tokens
Persona can limit username changes with tokens. By default, a profile earns one token every six months and can hold up to two tokens.
$profile->usernameTokens(); $profile->canChangeUsername(); $profile->changeUsername('signal-nick');
You can also use the helpers on your user model:
$user->personaUsernameTokens(); $user->canChangePersonaUsername(); $user->changePersonaUsername('signal-nick');
Query helpers
Persona::public()->get(); Persona::published()->get(); Persona::visible()->get();
Configuration
Publish the config file:
php artisan vendor:publish --tag=persona-config
Important options:
return [ 'tables' => [ 'profiles' => 'persona_profiles', 'users' => 'users', ], 'models' => [ 'persona' => EloquentWorks\Persona\Models\Persona::class, 'user' => null, ], 'storage' => [ 'disk' => 'public', ], 'routes' => [ 'show_name' => 'persona.show', ], 'usernames' => [ 'token_interval_months' => 6, 'tokens_per_interval' => 1, 'max_tokens' => 2, 'token_cost' => 1, 'unique' => true, ], ];
Documentation
Full docs are available in the docs directory:
Security
If you discover a security vulnerability, please report it privately instead of opening a public issue.
Credits
Built by Eloquent Works.
License
The MIT License.