A package to easily make use of country flags in your Laravel Blade views.
This package is using SVG flags provided by flag-icon-css. All credits go to this project and all of its creators.
Country flags in SVG format for your Laravel application. Uses lipis/flag-icons icons under the hood.
- PHP 8.0 or higher
- Laravel 8.0 or higher
composer require simtabi/laflamoji
While Blade Country Flags uses Blade Icons. Please refer to the Blade Icons readme for additional functionality. We also recommend to enable icon caching with this library. Flags can be used as self-closing Blade components which will be compiled to SVG flags:
// Render flag using default ratio:
@laflag('us')
// Tell what ratio to use, which classes, and attributes to add to the svg element:
@laflag('us:1x1', 'w-64', ['id' => 'flag-us'])
// Render emoji
@lamoji('us')
// Render flag using default ratio:
{{ laflamoji()->flag('us') }}
// Tell what ratio to use, which classes, and attributes to add to the svg element:
{{ laflamoji()->flag('us:1x1', 'w-64', ['id' => 'flag-us']) }}
// Render emoji
{{ laflamoji()->emoji('us') }}
Laflag 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 laflamoji.php
config file.
You may configure the default ratio to use, and default css classes to add:
# publish config files
php artisan vendor:publish --tag=laflamoji:config
# publish raw SVG files
php artisan vendor:publish --tag=laflamoji:assets
# publish view files
php artisan vendor:publish --tag=laflamoji:views
After publishing the raw SVG files, you can then use them in your views like:
<img src="{{ asset('vendor/laflamoji/flags/4x3/be.svg') }}" width="10"/>
<img src="{{ asset('vendor/laflamoji/twemoji/svg/1f1e6.svg) }}" width="10"/>
Check out the CHANGELOG in this repository for all the recent changes.
- Blade Icons - Code and Idea.
- Blade Country Flags - Code and Idea.
- Flags - Code and Idea.
- flag-icon-css - Wonderful SVG flags.
- circle-flags - Code and Idea.
- JSila/Emoji-Images-PHP - Code and Idea.
- Avris/Twemoji - Code and Idea.
- Astrotomic/php-twemoji - Code and Idea.
- flarum/emoji - Code and Idea.
- spatie/emoji - Code and Idea.
- unicodeveloper/laravel-emoji - Code and Idea.
- urakozz/php-emoji-regex - Code and Idea.
- hidehalo/emoji - Code and Idea.
- heyupdate/emoji - Code and Idea.
Laflamoji is open-sourced software licensed under the MIT license.