{"id":19653867,"url":"https://github.com/devaslanphp/filament-avatar","last_synced_at":"2026-04-04T00:03:25.136Z","repository":{"id":59760449,"uuid":"538998376","full_name":"devaslanphp/filament-avatar","owner":"devaslanphp","description":"A complete and customizable User Avatar provider for your Filament project, and also for any project using a User Model.","archived":false,"fork":false,"pushed_at":"2023-01-13T13:38:07.000Z","size":64,"stargazers_count":7,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-27T05:58:57.914Z","etag":null,"topics":["avatar","filament","gravatar","laravel","php","ui-avatars"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devaslanphp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-09-20T13:17:36.000Z","updated_at":"2024-12-31T13:28:10.000Z","dependencies_parsed_at":"2023-02-09T15:46:35.888Z","dependency_job_id":null,"html_url":"https://github.com/devaslanphp/filament-avatar","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/devaslanphp/filament-avatar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devaslanphp%2Ffilament-avatar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devaslanphp%2Ffilament-avatar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devaslanphp%2Ffilament-avatar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devaslanphp%2Ffilament-avatar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devaslanphp","download_url":"https://codeload.github.com/devaslanphp/filament-avatar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devaslanphp%2Ffilament-avatar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31382355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-03T23:20:52.058Z","status":"ssl_error","status_checked_at":"2026-04-03T23:20:51.675Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["avatar","filament","gravatar","laravel","php","ui-avatars"],"created_at":"2024-11-11T15:15:32.332Z","updated_at":"2026-04-04T00:03:25.092Z","avatar_url":"https://github.com/devaslanphp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Filament Avatar\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/devaslanphp/filament-avatar.svg?style=flat-square)](https://packagist.org/packages/devaslanphp/filament-avatar)\n[![Total Downloads](https://img.shields.io/packagist/dt/devaslanphp/filament-avatar.svg?style=flat-square)](https://packagist.org/packages/devaslanphp/filament-avatar)\n\nThis package provides a complete and customizable User Avatar provider for your Filament project, and also for any project using a User Model.\n\nFor now the avatar providers implemented are \n\n| Provider  | Website \u0026 Docs                                                                     |\n|-----------|------------------------------------------------------------------------------------|\n| UI Avatar | [\u003cimg src=\"github-content/ui-avatar.svg\" width=\"60px\" /\u003e](https://ui-avatars.com/) |\n| Gravatar  | [\u003cimg src=\"github-content/gravatar.jpg\" width=\"60px\" /\u003e](https://gravatar.com)     |\n\n# Installation\n\nYou can install the package via composer:\n\n```shell\ncomposer require devaslanphp/filament-avatar\n```\n\n*Optionally*: You can publish the package config file:\n\n```shell\nphp artisan vendor:publish --tag=filament-avatar-config\n```\n\nAfter 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:\n\n```php\n// ...\n'default_avatar_provider' =\u003e \\Devaslanphp\\FilamentAvatar\\Core\\FilamentUserAvatarProvider::class,\n// ...\n```\n\n**That's it**, Filament now will use the Avatar provider provided by this package.\n\n# Configuration\n\nThe configuration file of this package comes like below:\n\n```php\n\u003c?php\n\nreturn [\n\n    /*\n    |--------------------------------------------------------------------------\n    | DEFAULT PROVIDER\n    |--------------------------------------------------------------------------\n    |\n    | This value is the provider to use when generating the user's avatar url\n    |\n    */\n    'default_provider' =\u003e 'ui-avatar',\n\n    /*\n    |--------------------------------------------------------------------------\n    | PROVIDERS\n    |--------------------------------------------------------------------------\n    |\n    | This value is the definition of the different avatar providers\n    |\n    */\n    'providers' =\u003e [\n        // UI Avatar provider (https://ui-avatars.com/)\n        'ui-avatar' =\u003e [\n            // Class used to generate the user avatar\n            'class' =\u003e \\Devaslanphp\\FilamentAvatar\\Core\\UiAvatarsProvider::class,\n\n            // UI Avatar source url\n            'url' =\u003e 'https://ui-avatars.com/api/',\n\n            // User's field used to generate avatar\n            'name_field' =\u003e 'name',\n\n            // Color used in url text color\n            'text_color' =\u003e 'FFFFFF',\n\n            // Background color used if the 'dynamic_bg_color' flag is false\n            'bg_color' =\u003e '111827',\n\n            // If 'true' the provider will generate a dynamic 'bg_color' based on user's name\n            'dynamic_bg_color' =\u003e true,\n\n            // HSL ranges\n            // You can change them as you like to adapt the dynamic background color\n            'hRange' =\u003e [0, 360],\n            'sRange' =\u003e [50, 75],\n            'lRange' =\u003e [25, 60],\n        ],\n\n        // Gravatar provider (https://gravatar.com)\n        'gravatar' =\u003e [\n            // Class used to generate the user avatar\n            'class' =\u003e \\Devaslanphp\\FilamentAvatar\\Core\\GravatarProvider::class,\n\n            // Gravatar source url\n            'url' =\u003e 'https://www.gravatar.com/avatar/',\n\n            // User's field used to generate avatar\n            'name_field' =\u003e 'email'\n        ],\n    ],\n\n];\n```\n\nI think it's well documented, I will let you check it.\n\n# Custom provider\n\nIf you want to add your personalized avatar provider, Follow the below steps:\n1. Create a PHP class that implements a function `get(Model $user): string` (you can check `\\Devaslanphp\\FilamentAvatar\\Core\\GravatarProvider`)\n2. Add a new provider to `config('filament-avatar.providers')`, with `class` parameter where you will put your custom class (you can check the configuration file to make the same)\n3. Update the `config('filament.default_avatar_provider')` with your provider name\n\nAnd that's it \u003cimg src=\"github-content/smiley.png\" width=\"20px\"\u003e.\n\n## Pro tip\n\nThis package can be used outside of **Filament** too, you can add the trait `Devaslanphp\\FilamentAvatar\\Core\\HasAvatarUrl` to your user model.\n\nThis 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.\n\n## Support\n\nFor fast support, please join the [**Filament** community](https://filamentphp.com/discord) discord and send me a message in this channel [#avatar-provider](https://discord.com/channels/883083792112300104/1022104259644362823)\n\n## Credits\n\n- [heloufir](https://github.com/heloufir)\n- [All Contributors](https://github.com/devaslanphp/filament-avatar/graphs/contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevaslanphp%2Ffilament-avatar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevaslanphp%2Ffilament-avatar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevaslanphp%2Ffilament-avatar/lists"}