innovato/font-awesome-5-lite
Composer 安装命令:
composer require innovato/font-awesome-5-lite
包简介
A PHP library that generates Font Awesome 5 (Pro and Free) SVG JS files and stores them in a cache.
README 文档
README
This PHP library generates Font Awesome 5 (Pro and Free) SVG JS files and stores them in a cache. It only generates the icons that you need! It's useful for those who don't want to use third party CDN's or WebPack.
Due to possible copyright infringements you need to download the latest Font Awesome yourself and add it to the files/fa_source folder.
Quick start
Several quick start options are available:
- Download the latest release.
- Clone the repo:
git clone https://github.com/innovato/font-awesome-5-lite.git - Install with composer:
composer require innovato/font-awesome-5-lite
Get the Font Awesome 5 source files (required)
Get the Font Awesome 5 source files from their official website (https://fontawesome.com/). It's up to you to whether you want to use the Free or Pro version. They're both compatible with this library.
After the download you need to place the content of the Font Awesome svg-with-js/js folder in to the files/fa_source directory (or use your own assets directory).
If you choose to use your own assets directory, then make sure there's a subfolder called "fa_source" with the SVG JS files and also make sure the names are compatible.
Basic usage
With default settings
<?php include '../src/falite.php'; $faLite = new Innovato\FaLite(); $faLite->execute($_GET['icons']);
With all options
<?php include '../src/falite.php'; $faLite = new Innovato\FaLite(); $faLite->cacheEnabled = true; // Default true $faLite->cacheDirectory = '../files/cache'; $faLite->filesDirectory = '../files'; $faLite->types = [ 'fab' => 'fa-brands', 'fal' => 'fa-light', 'far' => 'fa-regular', 'fas' => 'fa-solid' ]; $faLite->execute($_GET['icons']);
Webserver configuration examples (optional)
You can use Nginx's rewrite to create a rule to make it look like it's a legit JS file. For example:
server {
...
rewrite ^/font-awesome-lite\.js$ /examples/example_minimal.php;
...
}
Or use Apache's mod_rewrite method:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^example_minimal\.php$ /font-awesome-lite.js?&%{QUERY_STRING}
</IfModule>
Adding Font Awesome Lite in your template
Add the generator URL to your HTML (use your own URL and path of course):
<script src="https://yourwebsite.com/assets/font-awesome-lite.js?icons=fab innovato, fas arrow-left"></script>
Options
| Name | Type | Description |
|---|---|---|
cacheEnabled |
boolean | This enables caching JS files [Default: true] |
cacheDirectory |
string | Full path to caching directory [Default: files/cache] |
filesDirectory |
string | Full path to files directory [Default: files] |
types |
array | The types and files to use [Default: [ 'fab' => 'fa-brands', 'fal' => 'fa-light', 'far' => 'fa-regular', 'fas' => 'fa-solid' ]] |
Credits
A big thanks to Font Awesome for the awesome SVG icons!
Copyright and license
Code and documentation copyright 2018 Innovato. Code released under the MIT License.
innovato/font-awesome-5-lite 适用场景与选型建议
innovato/font-awesome-5-lite 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 631 次下载、GitHub Stars 达 2, 最近一次更新时间为 2018 年 03 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「font awesome」 「Font Awesome Lite」 「Font Awesome CDN」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 innovato/font-awesome-5-lite 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 innovato/font-awesome-5-lite 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 innovato/font-awesome-5-lite 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
n2n framework 7
FontAwesome5 for Magento2
Provides quickstart to build Ecotone Lite Application with Event Sourcing
PHP SVG font parser
An asset bundle for Font Awesome icons with Bootstrap 4.
统计信息
- 总下载量: 631
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-03-20