codepil0t/laravel-country-flags

A Laravel package for country flags

Installs: 3

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/codepil0t/laravel-country-flags

1.0.0 2025-10-20 17:15 UTC

This package is auto-updated.

Last update: 2025-11-20 17:27:51 UTC


README

GitHub License: MIT

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.