This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Laravel package to convert country code (ISO 3166-1 alpha-2) to the corresponding flag emoji

0.2.0 2021-05-04 23:02 UTC

This package is auto-updated.

Last update: 2021-10-05 00:13:54 UTC


Run Tests Latest Stable Version Total Downloads

A Laravel package to convert country code (ISO 3166-1 alpha-2) to corresponding flag emoji.

This packages wraps Country Flags and all limitations on that package also apply to this.

Bendera means flag in Indonesian 🇮🇩.


You can install the package via composer:

composer require matriphe/bendera


It is not necessary, but if you want to add mapping, publish the config file.

php artisan vendor:publish --provider="Matriphe\Bendera\BenderaServiceProvider" --tag="bendera"

For example you want to map a custom country XY and shows it as ID.

return [
    'aliases' => [
        'XY' => 'ID',


You can use the Facade Bendera to get the emoji.

Bendera::emoji('id'); // will return 🇮🇩
Bendera::emoji('en'); // will return 🇬🇧
Bendera::emoji('uk'); // will return 🇬🇧
Bendera::emoji('GB'); // will return 🇬🇧
Bendera::emoji('XYZ'); // will return null

For invalid country code, it will return null;

You can also use dependency injection style by injecting BenderaContract to your class.

class SomeAwesomeClass 
    public function awesome(\Matriphe\Bendera\BenderaContract $bendera)
        return $bendera->emoji('id');


Contributions are welcome via Pull Requests on Github.


  • Stidges for his initial Country Flags package.
  • Spatie for their awesome packages.


The MIT License (MIT). Please see License File for more information.