laravel-country-flags maintained by codepil0t
Description
A Laravel package for country flags
Author
Last update
2025/10/20 19:15
(dev-main)
License
Downloads
304
LaravelCountryFlags Package for Laravel
This package provides country flags for Laravel applications (compatible with Laravel 8+ up to Laravel 12).
Installation
Install via Composer:
composer require codepil0t/laravel-country-flags
Publishing Assets
Publish the flag assets to your public directory:
php artisan vendor:publish --tag=flags
This will copy the flags to public/flags/.
Usage
In Blade Templates
Use the @flag directive:
<img src="@flag('de')" alt="Germany Flag">
Or use the helper function:
<img src="{{ flag_url('de') }}" alt="Germany Flag">
You can specify the aspect ratio (1x1 or 4x3, default is 4x3):
<img src="{{ flag_url('de', '1x1') }}" alt="Germany Flag">
In PHP
echo flag_url('de'); // /flags/4x3/de.svg
Supported Countries
All ISO 3166-1 alpha-2 country codes are supported.