mohammadhprp/filament-ip-to-country-flag-column
| Install | |
|---|---|
composer require mohammadhprp/filament-ip-to-country-flag-column |
|
| Latest Version: | v2.1.0 |
| PHP: | ^8.2 |
| License: | MIT |
| Last Updated: | Aug 17, 2026 |
| Links: | GitHub · Packagist |
IP to country flag Column for Filament 🚩
Display country flag from IP address in your Filament tables
This version supports Filament 5 and requires PHP 8.2 or newer.
Warning This plugin may cause a slight delay in page loading due to API calls to iplocation.
Screenshot

Installation
You can install the package via composer:
composer require mohammadhprp/filament-ip-to-country-flag-column
Usage
To use the package, follow these steps:
use Mohammadhprp\IPToCountryFlagColumn\Columns\IPToCountryFlagColumn;
IPToCountryFlagColumn::make('client_ip');
Options
-
Flag position: Change the position of the flag using
flagPosition. Available options:rightandleft.IPToCountryFlagColumn::make('client_ip')->flagPosition('left');💡 Note: Default flag position is
right. -
Hide flag: Hide the flag using
hideFlag.IPToCountryFlagColumn::make('client_ip')->hideFlag(); -
Location position: Change the location position using
location(). Available options:belowandabove.IPToCountryFlagColumn::make('client_ip')->location(position: 'above');💡 Note: Default location position is
below. -
Location separator: Change the location separator using
location().IPToCountryFlagColumn::make('client_ip')->location(separator: '-');💡 Note: Default location separator is
,. -
Hide city or country name: Hide city or country name using
hideCity()orhideCountry().IPToCountryFlagColumn::make('client_ip') ->hideCountry() ->hideCity(); -
Custom location resolver: Use a custom resolver to cache lookups or use another IP location provider.
IPToCountryFlagColumn::make('client_ip') ->locationResolver(fn (string $ip): array => [ 'country_code' => 'US', 'country_name' => 'United States', 'city' => 'Mountain View', ]); -
Lazy loading: Defer location lookups until the table has loaded. This avoids blocking the initial page response when the column is used with a deferred Filament table.
protected function table(Table $table): Table { return $table ->deferLoading() ->columns([ IPToCountryFlagColumn::make('client_ip')->lazy(), ]); }Location responses from the default provider are cached for 24 hours. Use
locationResolver()when you need application-specific caching or a different provider.
Testing
composer test
Example Application
The example/ directory contains a Laravel 12 and Filament 5 application
using this package through a local Composer path repository. See
example/README.md for setup and login instructions.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
- Fork the repository.
- Create a new branch for your feature.
- Make your changes and commit them with clear commit messages.
- Submit a pull request to the
masterbranch.
Credits
License
This project is licensed under the MIT License - see the License file for details.
Related Packages
Display multiple images as a stack in your Filament tables
A column for Filament Tables to which combines an avatar, name and description.
A comprehensive Laravel Filament 3 💡 starter kit with pre-installed plugins, ad...