genkgo/favicon
Composer 安装命令:
composer require genkgo/favicon
包简介
Generate browser favicons
README 文档
README
Requires PHP 8.1+ and both the imagick and DOM extension.
Install using composer
composer require genkgo/favicon
Create favicon package quick and easy
use Genkgo\Favicon; $outputDirectory = '/var/www/html/favicon'; $input = Favicon\Input::fromFile('/var/www/html/logo.png', InputImageType::PNG); // or add a different background color $input = Favicon\Input::fromFile('/var/www/html/logo.png', InputImageType::PNG, '#FF0000'); // or use a svg as input $input = Favicon\Input::fromFile('/var/www/html/logo.svg', InputImageType::SVG); // or create a letter avatar $input = Favicon\Input::digit('G', '#FFFFFF', '#00AAAD'); $generator = Favicon\FullPackageGenerator::newGenerator(); $manifest = new Favicon\WebApplicationManifest( Favicon\WebApplicationManifestDisplay::Standalone, 'Title of website', 'Short name of website', '#00AAAD', // theme color '#00AAAD', // tile color ); foreach ($generator->package($input, $manifest, '/') as $fileName => $contents) { $pathName = $outputDirectory . '/' . $fileName; file_put_contents($pathName, $contents); } // append the head tags to your document $document = new DOMDocument('1.0', 'UTF-8'); $html = $document->createElement('html'); $document->appendChild($html); $head = $document->createElement('head'); foreach ($generator->headTags($document, $manifest, '/') as $tag) { $head->appendChild($tag); } // or just generate the tag strings $tags = []; $document = new DOMDocument('1.0', 'UTF-8'); foreach ($generator->headTags($document, $manifest, '/') as $tag) { $tags[] = $document->saveHTML($tag); }
or use the command-line.
./vendor/bin/favicon-generator --help ./vendor/bin/favicon-generator 'Title of the website' file:public/logo.png output ./vendor/bin/favicon-generator 'Title of the website' file:public/logo.png output --theme-color=#00AAAD --icon-background=#00AAAD --root=/ ./vendor/bin/favicon-generator 'Title of the website' letter:G output ./vendor/bin/favicon-generator 'Title of the website' letter:G output --letter-color=#FFFFFF --theme-color=#00AAAD --icon-background=#00AAAD --root=/
Full package
- apple-touch-icon.png
- browserconfig.xml
- favicon.ico
- favicon.png
- favicon-16x16.png
- favicon-32x32.png
- favicon-48x48.ico
- favicon-48x48.png
- favicon-57x57.png
- favicon-76x76.png
- favicon-96x96.png
- favicon-128x128.png
- favicon-192x192.png
- favicon-228x228.png
- favicon-512x512.png
- index.html
- mstile-70x70.png
- mstile-150x150.png
- mstile-310x310.png
- safari-pinned-tab.svg
- web-app-manifest.json
Tests
There are no tests. Maybe later.
genkgo/favicon 适用场景与选型建议
genkgo/favicon 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 32.09k 次下载、GitHub Stars 达 10, 最近一次更新时间为 2023 年 08 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 genkgo/favicon 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 genkgo/favicon 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 32.09k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-08-01