marvinrabe/blade-flags

A package to easily make use of country flags in your Laravel Blade views.

Fund package maintenance!
marvinrabe

Installs: 88

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/marvinrabe/blade-flags

7.5.0 2026-02-12 23:05 UTC

This package is auto-updated.

Last update: 2026-02-12 23:08:51 UTC


README

Latest Version on Packagist GitHub Tests Action Status Total Downloads

A package to easily make use of country flags in your Laravel Blade views.

For a full list of available flags see the SVG directory or preview them at flag-icons. Flag SVGs are provided by lipis/flag-icons.

Requirements

  • PHP 8.0 or higher
  • Laravel 9.0 or higher

Installation

composer require marvinrabe/blade-flags

Blade Icons

Blade Flags uses Blade Icons under the hood. Please refer to the Blade Icons readme for additional functionality. We also recommend to enable icon caching with this library.

Configuration

Blade Flags also offers the ability to use features from Blade Icons like default classes, default attributes, etc. If you'd like to configure these, publish the blade-flags.php config file:

php artisan vendor:publish --tag=blade-flags-config

Usage

Icons can be used as self-closing Blade components which will be compiled to SVG icons:

<x-flag-4x3-us/>

You can also pass classes to your icon components:

<x-flag-4x3-us class="w-6 h-6"/>

And even use inline styles:

<x-flag-4x3-us style="color: #555"/>

Or use the @svg directive:

@svg('flag-4x3-us', 'w-6 h-6', ['style' => 'color: #555'])

Flags are available in two aspect ratios. The 4x3 flags:

<x-flag-4x3-us/>
<x-flag-4x3-de/>
<x-flag-4x3-fr/>

And the 1x1 (square) flags:

<x-flag-1x1-us/>
<x-flag-1x1-de/>
<x-flag-1x1-fr/>

Raw SVG Icons

If you want to use the raw SVG icons as assets, you can publish them using:

php artisan vendor:publish --tag=blade-flags --force

Then use them in your views like:

<img src="{{ asset('vendor/blade-flags/4x3-us.svg') }}" width="10" height="10"/>

Credits

License

Blade Flags is open-sourced software licensed under the MIT license.