Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/awcodes/filament-gravatar
Replace Filament's default avatar url provider with one for Gravatar.
https://github.com/awcodes/filament-gravatar
filament filament-plugin
Last synced: 2 months ago
JSON representation
Replace Filament's default avatar url provider with one for Gravatar.
- Host: GitHub
- URL: https://github.com/awcodes/filament-gravatar
- Owner: awcodes
- Created: 2022-07-11T16:50:15.000Z (over 2 years ago)
- Default Branch: 2.x
- Last Pushed: 2024-01-06T15:30:19.000Z (12 months ago)
- Last Synced: 2024-10-30T05:21:42.346Z (2 months ago)
- Topics: filament, filament-plugin
- Language: PHP
- Homepage:
- Size: 10.7 KB
- Stars: 26
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Filament Gravatar
Replace Filament's default avatar url provider with one for Gravatar.
![gravatar-og](https://res.cloudinary.com/aw-codes/image/upload/w_1200,f_auto,q_auto/plugins/gravatar/awcodes-gravatar.jpg)
## Installation
First, install the plugin with composer.
```bash
composer require awcodes/filament-gravatar
```Next, add the `GravatarProvider` to your panel.
```php
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`.
```php
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.
```php
Awcodes\FilamentGravatar\Gravatar::get(
string $email = null,
int $size = 80,
string $default = 'mp',
string $rating = 'g',
bool $asImage = false,
array $attributes = []
);
```