We all know that Filament comes with a \Filament\AvatarProviders\UiAvatarsProvider that uses the https://ui-avatars.com/ api to generate your users avatar. And of course, we can customize it by creating our own providers class.
But to make it more simple, you can use the package devaslanphp/filament-avatar that comes configured with the same ui-avatar provider and a gravatar provider, but also provider other options to make ui-avatar have dynamic background for example.
To use it, follow the steps below:
'default_avatar_provider' => \Devaslanphp\FilamentAvatar\Core\FilamentUserAvatarProvider::class,
That's it, now you can switch between ui-avatar and gravatar providers by simply updating the default_provider config on the config/filament-avatar.php file:
'default_provider' => 'ui-avatar'
As I mentioned above, this package can generate the ui-avatar with dynamic background color, by default this option is enabled on config('filament-avatar.providers.ui-avatar.dynamic_bg_color'), you can disable it if you want and specify you static background color in config('filament-avatar.providers.ui-avatar.bg_color').
More information about the package: devaslanphp/filament-avatar
No comments yet…