1. Go to this page and download the library: Download voltra/filament-svg-avatar library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
voltra / filament-svg-avatar example snippets
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,
];
class MyPanelProvider extends \Filament\PanelProvider {
public function panel(\Filament\Panel $panel) {
return $panel
// [...]
->defaultAvatarProvider(\Voltra\FilamentSvgAvatar\Filament\AvatarProviders\SvgAvatarsProviders::class)
// [...]
}
}
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')),
// [...]
])
// [...]
}
}
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)
// [...]
}
}
class MyPanelProvider extends \Filament\PanelProvider {
public function panel(\Filament\Panel $panel) {
return $panel
// [...]
->defaultAvatarProvider(\Voltra\FilamentSvgAvatar\Filament\AvatarProviders\RawSvgAvatarProvider::class)
// [...]
}
}