Skip to content

Replace Filament's default avatar url provider with one for Gravatar.

Notifications You must be signed in to change notification settings

awcodes/filament-gravatar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Filament Gravatar

Replace Filament's default avatar url provider with one for Gravatar.

gravatar-og

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 = []
);

About

Replace Filament's default avatar url provider with one for Gravatar.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages