PHPackages                             voltra/filament-svg-avatar - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. voltra/filament-svg-avatar

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

voltra/filament-svg-avatar
==========================

Change the default avatar url provider with one for inline SVGs

1.4.0(3mo ago)63.6k↓28.6%1MITPHPPHP ^8.2CI passing

Since Dec 17Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/Voltra/filament-svg-avatar)[ Packagist](https://packagist.org/packages/voltra/filament-svg-avatar)[ Docs](https://github.com/voltra/filament-svg-avatar)[ GitHub Sponsors](https://github.com/Voltra)[ RSS](/packages/voltra-filament-svg-avatar/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (16)Versions (17)Used By (0)

[![Filament Svg Avatar: Change the default avatar url provider with one for inline SVGs](https://raw.githubusercontent.com/Voltra/filament-svg-avatar/main/art/banner.jpeg)](https://raw.githubusercontent.com/Voltra/filament-svg-avatar/main/art/banner.jpeg)

voltra/filament-svg-avatar
==========================

[](#voltrafilament-svg-avatar)

[![Latest Version on Packagist](https://camo.githubusercontent.com/360baec8a0cd8b52969ff19def58bc65cfeb41b956b1f559b32ec74719fddf74/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f766f6c7472612f66696c616d656e742d7376672d6176617461722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/voltra/filament-svg-avatar)[![GitHub Tests Action Status](https://camo.githubusercontent.com/f32f8007aed1ee53e17d6b3bf9deb12b67850cf7801803aad2fdc859f9806cd0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f766f6c7472612f66696c616d656e742d7376672d6176617461722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/voltra/filament-svg-avatar/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/b6d8c8b1e5961dd479c7d44519375a6bcf69dfd95d50499d9883d7d865e1b4d2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f766f6c7472612f66696c616d656e742d7376672d6176617461722f6669782d7068702d636f64652d7374796c696e672e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/voltra/filament-svg-avatar/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/ce9c2ac5e22ed97da5654ecc519b342338d94cf5734ededc34474b4f588f0af9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f766f6c7472612f66696c616d656e742d7376672d6176617461722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/voltra/filament-svg-avatar)

Change the default avatar url provider with one for inline SVGs.

No more external HTTP requests just for default avatars.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require voltra/filament-svg-avatar
```

You can publish the config file with:

```
php artisan vendor:publish --tag="filament-svg-avatar-config"
```

Optionally, you can publish the views using

```
php artisan vendor:publish --tag="filament-svg-avatar-views"
```

This is the contents of the published config file:

```
return [
    /**
     * Global config of the SVG size
     *
     * @type ?int
     *
     * @default 500
     */
    'svgSize' => null,

    /**
     * Global config for the avatar's background color (as a hex code)
     *
     * @type ?string
     */
    'backgroundColor' => null,

    /**
     * Global config for the avatar's text color (as a hex code)
     *
     * @type ?string
     */
    'textColor' => null,

    /**
     * Global config for whether to disallow the plugin from overriding colors
     *
     * @type bool
     *
     * @default false
     */
    'disallowPluginOverride' => false,

    /**
     * Global config for the avatar's font-family
     *
     * @type ?string
     *
     * @default \Filament\Facades\Filament::getFontFamily()
     */
    'fontFamily' => null,

    /**
     * Global config of the SVG size
     *
     * @type ?string
     *
     * @default '.1em'
     */
    'textDy' => null,
];
```

Migrating from Filament v4 to Filament v5
-----------------------------------------

[](#migrating-from-filament-v4-to-filament-v5)

Since v1.4.0, filament-svg-avatar is also compatible with Filament v5.However, manual migration steps might need to be taken.

If you've been using the avatar override that is described further down, or have overriden the `avatar-override.blade.php` template, then you need to update the vendor view:

```
php artisan vendor:publish --tag=filament-svg-avatar-core-overrides --force
```

Migrating from Filament v3 to Filament v4
-----------------------------------------

[](#migrating-from-filament-v3-to-filament-v4)

Since v1.3.0, filament-svg-avatar is also compatible with Filament v4. However, manual migration steps might need to be taken.

If you've been using the avatar override that is described further down, or have overriden the `avatar-override.blade.php` template, then you need to update the vendor view:

```
php artisan vendor:publish --tag=filament-svg-avatar-core-overrides --force
```

Usage
-----

[](#usage)

### As the avatar provider

[](#as-the-avatar-provider)

Note `SvgAvatarsProviders` only renders properly if the font is available on the user's machine when the browser would decode the SVG as a base64 image.

If you want something portable, you'll need to replace Filament's default avatar component (see sections below).

```
class MyPanelProvider extends \Filament\PanelProvider {
    public function panel(\Filament\Panel $panel) {
        return $panel
            // [...]
            ->defaultAvatarProvider(\Voltra\FilamentSvgAvatar\Filament\AvatarProviders\SvgAvatarsProviders::class)
            // [...]
    }
}
```

### As a plugin

[](#as-a-plugin)

It automatically registers `SvgAvatarsProviders` as the avatar provider.

```
class MyPanelProvider extends \Filament\PanelProvider {
    public function panel(\Filament\Panel $panel) {
        return $panel
            // [...]
            ->plugins([
                // [...]
                \Voltra\FilamentSvgAvatar\FilamentSvgAvatarPlugin::make()
                    ->backgroundColor(\Spatie\Color\Hex::fromString('#3b5998'))
                    ->textColor(\Spatie\Color\Hex::fromString('#e9ebee')),
                // [...]
            ])
            // [...]
    }
}
```

NB: If you register the plugin and want to register a provider that isn't our `SvgAvatarsProviders` (e.g. to use `RawSvgAvatarProvider`), you'll have to register it manually AFTER the plugin. Other providers from this package can be registered before (or after) the plugin, but external providers need to be registered after the plugin.

```
class MyPanelProvider extends \Filament\PanelProvider {
    public function panel(\Filament\Panel $panel) {
        return $panel
            // [...]
            ->plugins([
                // [...]
                \Voltra\FilamentSvgAvatar\FilamentSvgAvatarPlugin::make()
                    ->backgroundColor(\Spatie\Color\Hex::fromString('#3b5998'))
                    ->textColor(\Spatie\Color\Hex::fromString('#e9ebee')),
                // [...]
            ])
            ->defaultAvatarProvider(\Voltra\FilamentSvgAvatar\Filament\AvatarProviders\RawSvgAvatarProvider::class)
            // [...]
    }
}
```

### Replace filament's default avatar component

[](#replace-filaments-default-avatar-component)

First change the default avatar provider to use `\Voltra\FilamentSvgAvatar\Filament\AvatarProviders\RawSvgAvatarProvider::class` so that it can properly use the initials instead of a URL:

```
class MyPanelProvider extends \Filament\PanelProvider {
    public function panel(\Filament\Panel $panel) {
        return $panel
            // [...]
            ->defaultAvatarProvider(\Voltra\FilamentSvgAvatar\Filament\AvatarProviders\RawSvgAvatarProvider::class)
            // [...]
    }
}
```

Then you'll have to override filament's avatar blade component.

If you don't want to do it manually, just execute this command:

```
php artisan vendor:publish --tag=filament-svg-avatar-core-overrides
```

If you want to do it manually: either publish filament's support package's views, or just create the `resources/views/vendor/filament/components/avatar.blade.php` file with the following content.

```
@props([
    'circular' => true,
    'size' => 'md',
])

```

This will use the `` component, configure it based on what `` expects, and output an `` instead of an `` (which means better custom font support!).

### Extend or override

[](#extend-or-override)

NB: Config values take precedence over overrides

Create a class that implements the `\Voltra\FilamentSvgAvatar\Contracts\SvgAvatarServiceContract` interface.

You can even extend from `\Voltra\FilamentSvgAvatar\Services\FilamentSvgAvatarService`.

Then, in a service provider, bind your implementation to the interface:

```
class MyServiceProvider extends \Illuminate\Support\ServiceProvider {
    // [...]

    public function register() {
        // [...]
        $this->app->scoped(\Voltra\FilamentSvgAvatar\Contracts\SvgAvatarServiceContract::class, MySvgAvatarServiceImpl::class);
        // [...]
    }

    // [...]
}
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](https://github.com/Voltra/filament-svg-avatar/blob/main/CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/Voltra/filament-svg-avatar/blob/main/.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](https://github.com/Voltra/filament-svg-avatar/security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Voltra](https://github.com/Voltra)
- [All Contributors](https://github.com/Voltra/filament-svg-avatar/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/Voltra/filament-svg-avatar/blob/main/LICENSE.md) for more information.

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance82

Actively maintained with recent releases

Popularity29

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~56 days

Recently: every ~167 days

Total

15

Last Release

97d ago

PHP version history (2 changes)1.0.0PHP ^8.1

1.3.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/802602e0aeb4b70b8385bfa34308b3d1aa55baa9b41d9216cbd824da0d7bcad0?d=identicon)[Voltra](/maintainers/Voltra)

---

Top Contributors

[![Voltra](https://avatars.githubusercontent.com/u/25990549?v=4)](https://github.com/Voltra "Voltra (140 commits)")

---

Tags

filamentfilament-pluginfilamentphpfilamentphp-pluginhacktoberfestlaravellaravel-packagelaravelavatarfilamentlaravel-filamentVoltrafilament-svg-avatar

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/voltra-filament-svg-avatar/health.svg)

```
[![Health](https://phpackages.com/badges/voltra-filament-svg-avatar/health.svg)](https://phpackages.com/packages/voltra-filament-svg-avatar)
```

###  Alternatives

[pboivin/filament-peek

Full-screen page preview modal for Filament

253319.6k12](/packages/pboivin-filament-peek)[dotswan/filament-map-picker

Easily pick and retrieve geo-coordinates using a map-based interface in your Filament applications.

124139.3k2](/packages/dotswan-filament-map-picker)[creagia/filament-code-field

A Filamentphp input field to edit or view code data.

58289.3k3](/packages/creagia-filament-code-field)[swisnl/filament-backgrounds

Beautiful backgrounds for Filament auth pages

54149.2k6](/packages/swisnl-filament-backgrounds)[guava/calendar

Adds support for vkurko/calendar to Filament PHP.

298241.0k3](/packages/guava-calendar)[tapp/filament-google-autocomplete-field

Filament plugin that provides a Google Autocomplete field

3098.1k](/packages/tapp-filament-google-autocomplete-field)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
