catap97 / laravel-envicon
根据您的当前运行环境使用不同的favicon
v1.0.0
2024-04-11 07:07 UTC
Requires
- php: ~8.0 || ~8.1 || ~8.2 || ~8.3
- illuminate/support: ^9.0 || ^10.0 || ^11.0
Requires (Dev)
- orchestra/testbench: ^7.0 || ^8.0
- phpunit/phpunit: ^9.0 || ^10.0
README
此包允许您根据运行环境显示自定义favicon,这使得您能立即识别正在浏览的环境。
安装
通过Composer
composer require catap97/laravel-envicon
安装完包后,您需要将配置发布以将环境与自定义favicon关联。
php artisan vendor:publish --tag=envicon-config
如果您想使用此包提供的默认envicons,运行以下命令,它们将被复制到您的public/favicons
文件夹。
php artisan vendor:publish --tag=envicon-favicons
用法
只需在您favicon的URL位置使用提供的辅助函数。这将返回与您的当前运行环境匹配的favicon。
<!doctype html> <html lang="en"> <head> <link rel="icon" href="{{ Envicon::url() }}"> </head> </html>
如果您需要特定环境的favicon的URL,请使用以下语句代替。您需要将环境名称作为第一个参数传递。
<!doctype html> <html lang="en"> <head> <link rel="icon" href="{{ Envicon::for('production') }}"> </head> </html>
测试
可以使用以下composer脚本来运行测试。
composer test
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。