Download the PHP package devaslanphp/filament-avatar without Composer
On this page you can find all versions of the php package devaslanphp/filament-avatar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download devaslanphp/filament-avatar
More information about devaslanphp/filament-avatar
Files in devaslanphp/filament-avatar
Package filament-avatar
Short Description A complete and customizable User Avatar provider for your Filament project, and also for any project using a User Model.
License MIT
Homepage https://github.com/devaslanphp/filament-avatar
Informations about the package filament-avatar
Filament Avatar
This package provides a complete and customizable User Avatar provider for your Filament project, and also for any project using a User Model.
For now the avatar providers implemented are
Provider | Website & Docs |
---|---|
UI Avatar | |
Gravatar |
Installation
You can install the package via composer:
Optionally: You can publish the package config file:
After you installed the package the only thing you need to do is to change the filament default_avatar_provider
configuration to use FilamentUserAvatarProvider
avatar provider:
That's it, Filament now will use the Avatar provider provided by this package.
Configuration
The configuration file of this package comes like below:
I think it's well documented, I will let you check it.
Custom provider
If you want to add your personalized avatar provider, Follow the below steps:
- Create a PHP class that implements a function
get(Model $user): string
(you can check\Devaslanphp\FilamentAvatar\Core\GravatarProvider
) - Add a new provider to
config('filament-avatar.providers')
, withclass
parameter where you will put your custom class (you can check the configuration file to make the same) - Update the
config('filament.default_avatar_provider')
with your provider name
And that's it .
Pro tip
This package can be used outside of Filament too, you can add the trait Devaslanphp\FilamentAvatar\Core\HasAvatarUrl
to your user model.
This trait will give you access to an appended attribute avatarUrl
generated by the avatar provider, then you can use it as a src
of your images.
Support
For fast support, please join the Filament community discord and send me a message in this channel #avatar-provider
Credits
License
The MIT License (MIT). Please see License File for more information.