rawilk/profile-filament-plugin
Filament plugin that jumpstarts a user profile area with multi-factor authentication, password and session management, migrations, and sensible defaults—opinionated but customizable. Designed to remove boilerplate and integrate cleanly into your panel.
Installation
composer require rawilk/profile-filament-plugin
php artisan vendor:publish --tag="profile-filament-migrations"
php artisan vendor:publish --tag="profile-filament-config"
php artisan migrate
Register Plugin
Add to your PanelProvider:
use Rawilk\ProfileFilament\ProfileFilamentPlugin;
public function panel(Panel $panel): Panel {
return $panel->plugin(ProfileFilamentPlugin::make());
}
First Use Case
Access /profile in your Filament admin panel to see the default profile page with basic user info, security settings, sessions, and account management.
Profile Customization Override default pages or components via plugin methods:
ProfileFilamentPlugin::make()
->profileInfoPage(ProfileInfo::make()->title('Custom Profile'))
->securityPage(Security::make()->slug('security-settings'));
Component Replacement Replace Livewire components in pages:
ProfileInfo::make()->components([
App\Livewire\CustomProfileForm::class,
]);
Schema Customization Modify infolist schemas in a service provider:
ProfileInfolist::configureComponents(fn () => [
Section::make()->schema([TextEntry::make('custom_field')])
]);
Authentication Integration
Ensure your User model implements Filament\Contracts\HasAvatar and Filament\Contracts\HasProfilePhoto for profile photos.
MFA Setup Use the built-in MFA pages (TOTP, Recovery Codes) without additional setup:
// Enable/disable MFA features in config/profile-filament.php
'mfa' => [
'enabled' => true,
'providers' => ['totp', 'recovery_codes'],
]
Session Management
Leverage the Sessions page for revoking active sessions:
// Customize session table columns
Sessions::make()->tableColumns([
Tables\Columns\TextColumn::make('browser'),
Tables\Columns\TextColumn::make('ip_address'),
]);
Account Deletion
Extend the Settings page to add custom confirmation logic:
Settings::make()->deleteAccountAction(
DeleteAccountAction::make()->requiresConfirmation()
);
Slug Conflicts
slug() for pages to avoid Filament’s default default slug.Security::make()->slug('authentication'); // Avoids 'default' slug
Navigation Group Issues
filament.php config under language.navigationGroup('profile.group.my_group', true)
MFA Provider Dependencies
paragonie/googleauth:
composer require paragonie/googleauth
spatie/laravel-activitylog for audit trails (optional but recommended).Livewire Component Overrides
extends \Rawilk\ProfileFilament\Livewire\Profile\ProfileInfo).Migration Conflicts
If migrations fail, check for existing users or sessions tables. The plugin adds:
user_mfa_codes (for recovery codes)user_sessions (extended session table)Configuration Overrides Publish the config file to override defaults:
php artisan vendor:publish --tag="profile-filament-config" --force
Livewire Component Debugging
Use Filament’s --debug flag to inspect component rendering:
php artisan filament:debug
Custom Profile Fields
Extend the ProfileInfolist or EditProfileForm schemas:
ProfileInfolist::configureComponents(fn ($user) => [
TextEntry::make('custom_field')->onlyWhen(fn () => $user->hasRole('admin')),
]);
Event Listeners
Listen for profile-related events (e.g., ProfileUpdated):
use Rawilk\ProfileFilament\Events\ProfileUpdated;
event(new ProfileUpdated($user, $data));
API Endpoints Use Filament’s API resources to expose profile data:
// In a Filament API resource
public static function getPages(): array {
return [
'profile' => \Rawilk\ProfileFilament\Filament\Pages\Profile\ProfileInfo::class,
];
}
Testing Use the provided test helpers:
use Rawilk\ProfileFilament\Testing\TestsProfileFilament;
public function test_profile_page() {
$this->actingAs($user)
->get('/profile')
->assertSuccessful();
}
Disable Features
Toggle features in config/profile-filament.php:
'features' => [
'password_reset' => false,
'email_verification' => true,
]
Dark Mode Support Ensure your custom components use Filament’s dark mode classes:
<x-filament::section dark>
<!-- Component content -->
</x-filament::section>
Performance
Lazy-load heavy components (e.g., session tables) with shouldBeLoaded():
Sessions::make()->shouldBeLoaded(fn () => Auth::user()->hasPermission('view_sessions'));
How can I help you explore Laravel packages today?