matriphe/bendera 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

matriphe/bendera

最新稳定版本:0.4.1

Composer 安装命令:

composer require matriphe/bendera

包简介

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

README 文档

README

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 🇮🇩.

Installation

You can install the package via composer:

Laravel 10

composer require matriphe/bendera

Laravel 9 or Older

composer require matriphe/bendera:0.3.0

Configuration

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',
    ]
];

Usage

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');
    }
}

Contributing

Contributions are welcome via Pull Requests on Github.

Credits

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

License

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

统计信息

  • 总下载量: 399
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-05-04