tinusg/filament-company-logo-column
Filament table column that displays a company logo via Logo.dev from a URL or bare domain. Supports tooltips (e.g., company name), domain overrides, sizing and format options, themes, fallbacks, and lazy loading. Configurable Logo.dev publishable key.
Install the package:
composer require tinusg/filament-company-logo-column
Configure Logo.dev:
Add your publishable key to .env:
LOGO_DEV_PUBLISHABLE_KEY=pk_XXXXXXXXXXXXXXXXX
Ensure it’s reflected in config/services.php under 'logo_dev'.
First usage: Add the column to a Filament resource table:
use TinusG\FilamentCompanyLogoColumn\CompanyLogoColumn;
public static function table(Table $table): Table {
return $table->columns([
CompanyLogoColumn::make('website')
->tooltip(fn ($record) => $record->name),
]);
}
Replace a plain TextColumn for URLs/domains with a visual logo column. For example, in a CompaniesTable resource, swap:
TextColumn::make('website')
for:
CompanyLogoColumn::make('website')
->tooltip(fn ($record) => $record->name)
->size(32)
Column Integration:
TextColumn or UrlColumn that displays domains/URLs.website field) directly or override with a closure:
CompanyLogoColumn::make('logo')
->domain(fn ($record) => $record->primary_url)
Styling & Behavior:
->size(48) // Pixel size (e.g., 40px default)
->theme('dark') // Dark/light theme
->format('webp') // Image format
->fallback('monogram') // Fallback mode
->lazy() // Lazy-load images
tooltip() for hover tooltips (Filament’s built-in feature).Dynamic Sources:
logo_url vs. domain), use the domain() method:
CompanyLogoColumn::make('logo_url')
->domain(fn ($record) => parse_url($record->logo_url, PHP_URL_HOST))
Conditional Rendering:
domain() closure:
->domain(fn ($record) => $record->website ?? null)
Global Defaults:
config/filament-company-logo-column.php:
'defaults' => [
'size' => 48,
'theme' => 'dark',
],
Custom Placeholders:
php artisan vendor:publish --tag=filament-company-logo-column-views) and extend the Blade template (resources/views/vendor/filament-company-logo-column/column.blade.php).Performance:
lazy() for large tables to defer offscreen logo loading.Invalid Domains:
example), or missing TLDs (e.g., google) render as placeholders. Validate input upstream:
->domain(fn ($record) => filter_var($record->website, FILTER_VALIDATE_DOMAIN) ?: null)
Missing API Key:
LOGO_DEV_PUBLISHABLE_KEY, the column shows a neutral placeholder. Test locally with:
LOGO_DEV_PUBLISHABLE_KEY=pk_test_XXXXXX
Caching:
?v=2 to force refresh during development.Dark Mode:
theme('dark') option doesn’t auto-switch with prefers-color-scheme. Manually toggle based on user preference or Filament’s dark mode state.Broken Images:
src="https://img.logo.dev/...". Use browser dev tools to verify the URL resolves correctly.Placeholder Overrides:
php artisan view:clear
Size Issues:
size(24) to debug scaling.Tooltip Customization:
tooltip() with rich content:
->tooltip(fn ($record) => view('filament.components.logo-tooltip', ['record' => $record]))
Clickable Logos:
LinkColumn for interactivity:
LinkColumn::make('website')
->getStateUsing(fn ($record) => $record->website)
->icon(CompanyLogoColumn::make('website')->size(24))
Testing:
HostnameNormalizer or using a local proxy (e.g., logo.dev’s test API).Fallback Styling:
.filament-company-logo-column__placeholder {
background: #f0f0f0;
border-radius: 4px;
}
Future-Proofing:
TableColumn subclass if needed.How can I help you explore Laravel packages today?