awcodes / filament-gravatar
Replace Filament's default avatar url provider with one for Gravatar.
Installs: 93 999
Dependents: 3
Suggesters: 0
Security: 0
Stars: 26
Watchers: 2
Forks: 2
Open Issues: 0
Type:package
Requires
- php: ^8.1
- filament/filament: ^3.0
- spatie/laravel-package-tools: ^1.15
Requires (Dev)
- laravel/pint: ^1.0
This package is auto-updated.
Last update: 2024-12-06 17:47:55 UTC
README
Replace Filament's default avatar url provider with one for Gravatar.
Installation
First, install the plugin with composer.
composer require awcodes/filament-gravatar
Next, add the GravatarProvider
to your panel.
use Awcodes\FilamentGravatar\GravatarProvider; public function panel(Panel $panel): Panel { return $panel ->defaultAvatarProvider(GravatarProvider::class) ->plugins([ GravatarPlugin::make(), ]) }
Global Defaults
You can modify the global defaults by using the following methods on the GravatarPlugin
.
public function panel(Panel $panel): Panel { return $panel ->plugins([ GravatarPlugin::make() ->default('robohash') ->size(200) ->rating('pg'), ]) }
Additional Info
You can also use the Awcodes\FilamentGravatar\Gravatar
class by itself should you need to outside a panel.
Awcodes\FilamentGravatar\Gravatar::get( string $email = null, int $size = 80, string $default = 'mp', string $rating = 'g', bool $asImage = false, array $attributes = [] );