agatanga / flags
Laravel 应用中的 SVG 格式国家旗帜。
1.1.0
2024-05-12 14:21 UTC
Requires
- php: ^7.3|^8.0
- illuminate/contracts: ^7.14|^8.0|^9.0|^10.0|^11.0
- illuminate/filesystem: ^7.14|^8.0|^9.0|^10.0|^11.0
- illuminate/support: ^7.14|^8.0|^9.0|^10.0|^11.0
- lipis/flag-icons: ^6.8|^7.0
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
致谢
- lipis/flag-icons - 精美的 SVG 旗帜。
- blade-ui-kit/blade-icons - 代码和灵感。