agatanga/flags

Laravel 应用中的 SVG 格式国家旗帜。

1.1.0 2024-05-12 14:21 UTC

This package is auto-updated.

Last update: 2024-09-12 15:05:33 UTC


README

Laravel 应用中的 SVG 格式国家旗帜。底层使用 lipis/flag-icons 图标。

安装

composer require agatanga/flags

使用方法

指令

// Render flag using default ratio:
@flag('us')

// Tell what ratio to use, which classes, and attributes to add to the svg element:
@flag('us:1x1', 'w-64', ['id' => 'flag-us'])

助手函数

// Render flag using default ratio:
{{ flag('us') }}

// Tell what ratio to use, which classes, and attributes to add to the svg element:
{{ flag('us:1x1', 'w-64', ['id' => 'flag-us']) }}

配置

您可以配置要使用的默认比例以及要添加的默认 CSS 类。

php artisan vendor:publish --provider="Agatanga\Flags\FlagsServiceProvider"
vi config/flags.php

致谢