diogogpinto/filament-auth-ui-enhancer
Installation:
composer require diogogpinto/filament-auth-ui-enhancer
Publish the config file (if needed):
php artisan vendor:publish --provider="Diogogpinto\FilamentAuthUIEnhancer\FilamentAuthUIEnhancerServiceProvider" --tag="config"
Register the Plugin:
In your PanelServiceProvider (or AppServiceProvider if no panel provider exists), add:
use Diogogpinto\FilamentAuthUIEnhancer\FilamentAuthUIEnhancerPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
FilamentAuthUIEnhancerPlugin::make(),
]);
}
First Use Case: Replace the default login page with a custom design by overriding the default views:
vendor/diogogpinto/filament-auth-ui-enhancer/resources/views to resources/views/vendor/filament-auth-ui-enhancer.auth/login.blade.php) to match your brand.config/filament-auth-ui-enhancer.php (if published) for global settings like default colors, logos, or social auth buttons.resources/views/vendor/filament-auth-ui-enhancer for UI customization.Override Views:
Copy the default views (e.g., login, register, forgot-password) from the package to your project’s resources/views/vendor/filament-auth-ui-enhancer directory. Modify them to fit your design system.
Example:
<!-- resources/views/vendor/filament-auth-ui-enhancer/auth/login.blade.php -->
<x-filament-auth-ui-enhancer::auth-section>
<x-slot name="logo">
<img src="{{ asset('images/custom-logo.svg') }}" alt="Logo">
</x-slot>
<x-slot name="description">
Welcome to our platform!
</x-slot>
<!-- Custom form fields or sections -->
</x-x-filament-auth-ui-enhancer::auth-section>
Dynamic Content: Use Blade slots to inject dynamic content (e.g., logos, descriptions, or CTAs):
<x-filament-auth-ui-enhancer::auth-section>
<x-slot name="logo">
{{ $logo ?? '' }}
</x-slot>
</x-filament-auth-ui-enhancer::auth-section>
Social Auth Buttons: Enable and configure social auth (e.g., Google, GitHub) via the config:
// config/filament-auth-ui-enhancer.php
'social_auth' => [
'google' => [
'enabled' => true,
'client_id' => env('GOOGLE_CLIENT_ID'),
'client_secret' => env('GOOGLE_CLIENT_SECRET'),
],
'github' => [
'enabled' => false,
],
],
Customize the buttons in the overridden views:
@if(config('filament-auth-ui-enhancer.social_auth.google.enabled'))
<x-filament-auth-ui-enhancer::social-auth-button
provider="google"
label="Sign in with Google"
/>
@endif
Animations/Transitions: Leverage built-in animations by extending the default views with Tailwind CSS classes or custom JS:
<div class="animate-fade-in">
<!-- Form content -->
</div>
Localization:
Override language files in resources/lang/vendor/filament-auth-ui-enhancer to customize labels or messages.
Dark Mode:
Ensure your custom views support Filament’s dark mode by using Tailwind’s dark: variants or the @filamentThemes directive:
<div class="dark:text-white">
<!-- Content -->
</div>
Form Validation:
Extend the default validation logic by publishing and modifying the AuthServiceProvider or using Filament’s form components:
use Filament\Forms\Components\TextInput;
public function registerLoginForm(): array
{
return [
TextInput::make('email')
->email()
->required()
->label('Custom Email Label'),
];
}
php artisan vendor:publish --tag="filament-auth-ui-enhancer-views"
resources/views/vendor/filament-auth-ui-enhancer.config/filament-auth-ui-enhancer.php for social auth, captcha, or other settings.View Override Conflicts:
php artisan vendor:publish --tag="filament-auth-ui-enhancer-views"
Cached Assets:
php artisan filament:cache:clear
Or disable caching in config/filament.php during development:
'cache' => false,
Social Auth Misconfiguration:
.env variables (e.g., GOOGLE_CLIENT_ID) and check the package logs:
tail -f storage/logs/laravel.log
Theme Inconsistencies:
<div style="color: {{ filament()->getThemeColor('primary') }}">
<!-- Content -->
</div>
Log Social Auth Errors:
Add debug logs in your AuthServiceProvider or use Laravel’s logging:
try {
$user = Socialite::driver('google')->user();
} catch (\Exception $e) {
\Log::error('Social Auth Error: ' . $e->getMessage());
}
Inspect Blade Output:
Use @dump or {{ dd() }} in custom views to debug dynamic content:
@dump($this->getAuthPageData())
Check Plugin Events: Listen for plugin events to debug initialization:
use Diogogpinto\FilamentAuthUIEnhancer\Events\AuthUIEnhancerInitialized;
AuthUIEnhancerInitialized::listen(function ($plugin) {
\Log::info('Plugin initialized:', [$plugin->getConfig()]);
});
Custom Auth Pages:
<x-filament-auth-ui-enhancer::base-layout>
<!-- Custom content -->
</x-filament-auth-ui-enhancer::base-layout>
Dynamic Config:
Override the config dynamically in your PanelServiceProvider:
FilamentAuthUIEnhancerPlugin::make()
->config([
'logo' => asset('images/custom-logo.png'),
'social_auth' => [
'google' => ['enabled' => false],
],
]),
Add Custom Fields: Extend the default forms by publishing and modifying the form components:
php artisan vendor:publish --tag="filament-auth-ui-enhancer-forms"
Then customize resources/views/vendor/filament-auth-ui-enhancer/forms/login.blade.php.
Localization: Add custom language files for unsupported locales:
mkdir -p resources/lang/pt/vendor/filament-auth-ui-enhancer
Create auth.php with your translations.
How can I help you explore Laravel packages today?