Laravel Blade Country and Language Icons


November 18th, 2022

Laravel Blade Country and Language Icons

Laravel Blade Flags is a package to easily display countries & languages flags in your Laravel Blade views. When you have a project needing to display various country flags, you might hunt for SVG icons or JS components. This package has your back if you are using Blade as you can render flags as components or use the provided SVGs:

<x-flag-country-br />
<x-flag-country-cn />
<x-flag-country-gb />
<x-flag-country-ru />
<x-flag-country-us />

The above blade components would render something like this:

blade svg output example

For styling, you can also provide a class attribute:

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

You can also publish the SVGs that ship with this package using the asset helper:

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

This project uses the excellent Blade UI Kit, a set of renderless components to utilize in your Laravel Blade views. If you're interested in using this package and seeing how it utilizes Blade UI Kit, check it out on GitHub.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.