codeat3/blade-phosphor-icons

一个易于在Laravel Blade视图中使用"Phosphor Icons"的包。

2.2.0 2024-04-08 19:02 UTC

This package is auto-updated.

Last update: 2024-09-14 11:52:14 UTC


README

Blade Phosphor Icons v2

Tests Latest Stable Version Total Downloads

一个易于在Laravel Blade视图中使用 Phosphor Icons 的包。

查看完整的图标列表,请访问 SVG 目录 或在 phosphoricons.com 预览。

要求

  • PHP 7.4 或更高版本
  • Laravel 8.0 或更高版本

安装

对于Phosphor Icons v1

composer require codeat3/blade-phosphor-icons:^1.0

对于Phosphor Icons v2

composer require codeat3/blade-phosphor-icons:^2.0

更新

在更新库时,请参阅 升级指南

Blade Icons

Blade Phosphor Icons 在底层使用 Blade Icons。有关更多功能,请参阅 Blade Icons 的 README。我们还建议使用此库时启用 图标缓存

配置

Blade Phosphor Icons 还提供使用 Blade Icons 功能的能力,例如默认类、默认属性等。如果您想配置这些,请发布 blade-phosphor-icons.php 配置文件

php artisan vendor:publish --tag=blade-phosphor-icons-config

使用

图标可以作为自闭合的 Blade 组件使用,它们将被编译为 SVG 图标

<x-phosphor-alarm/>

您也可以向图标组件传递类

<x-phosphor-alarm class="w-6 h-6 text-gray-500"/>

并且还可以使用内联样式

<x-phosphor-alarm style="color: #555"/>

或者使用 @svg 指令

@svg('phosphor-alarm', 'w-6 h-6', ['style' => 'color: #555'])

可以通过这种方式引用 6 种权重

<x-phosphor-alarm/>         <!-- Regular svg -->
<x-phosphor-alarm-bold/>    <!-- For bold svg icon add `-bold` suffix -->
<x-phosphor-alarm-duotone/> <!-- For duotone svg icon add `-duotone` suffix -->
<x-phosphor-alarm-fill/>    <!-- For fill svg icon add `-fill` suffix -->
<x-phosphor-alarm-light/>   <!-- For light svg icon add `-light` suffix -->
<x-phosphor-alarm-thin/>    <!-- For thin svg icon add `-thin` suffix -->

原始 SVG 图标

如果您想将原始 SVG 图标作为资产使用,可以使用以下方式发布它们

php artisan vendor:publish --tag=blade-phosphor-icons --force

然后在视图中使用它们,如下所示

<img src="{{ asset('vendor/blade-phosphor-icons/alarm.svg') }}" width="10" height="10"/>

Blade Icons

Blade Phosphor Icons 在底层使用 Blade Icons。有关更多功能,请参阅 Blade Icons 的 README

变更日志

在此存储库中查看 CHANGELOG 以获取所有最近更改。

维护者

Blade Phosphor Icons 由 Swapnil Sarwe 开发和维护。

许可证

Blade Phosphor Icons 是开源软件,根据 MIT 许可证 授权。