bca/fontawesomeiterator
最新稳定版本:1.0.0
Composer 安装命令:
composer require bca/fontawesomeiterator
包简介
Iterate through the icons in FontAwesome or get them as an array.
关键字:
README 文档
README
Iterate through the icons in FontAwesome or get them as an array.
Wait. So what is this?
Simply put, this class was created to let you iterate over FontAwesome's icons for the purpose of building user interfaces in which one must be able to choose their own icons. That said, if you have another creative use for this, go for it!
This class extends PHP's built-in ArrayIterator
class, returning an Icon class for each icon in your local copy of FontAwesome.
Requirements
- PHP 5.2+
- FontAwesome (Defaults created for 4.0+, but can be configured for any version.)
Installation
Via Composer
Just add the following to the require section your composer.json file:
"bca/fontawesomeiterator": "1.*"
Then execute composer install to pull down the latest release.
Package details can be found at https://packagist.org/packages/bca/fontawesomeiterator.
Via Github
You may download a specific version from https://github.com/brodkinca/BCA-PHP-FontAwesomeIterator/releases or visit the main repository at https://github.com/brodkinca/BCA-PHP-FontAwesomeIterator to download unreleased code or pull down a copy via git.
Basic Usage
1. Create an Instance of the Iterator
use BCA\FontAwesomeIterator\Iterator as FontAwesomeIterator; $icons = new FontAwesomeIterator('path/to/fontawesome.css');
2. Do Something Useful
foreach loop
foreach ($icons as $icon) { echo $icon->class; // Do Something Here }
while loop
while ($icons->valid()) { $icon = $icons->current(); echo $icon->class; // Do Something Here $icons->next(); }
Advanced Usage
If you are using an older version of FontAwesome that still uses the icon- css
prefix or a custom build of FontAweosme with a non-standard prefix it is necessary
to define the prefix when instantiating the class.
Old Skool icon Prefix
Reqired for FontAwesome v3 and under.
$icons = new FontAwesomeIterator('path/to/fontawesome.css', 'icon');
Custom Prefix
$icons = new FontAwesomeIterator('path/to/fontawesome.css', 'my-custom-prefix');
NOTE: The prefix should be defined without any additional hyphenation.
(i.e. prefix) NOT prefix-.
Example Implementation
Create a Select List of Icons by Name
<select> <?php foreach ($icons as $icon) { echo '<option value="'.$icon->class.'">'.$icon->name.'</option>'; } ?> </select>
With the correct CSS it would also be possible to display the FontAwesome icon in the select list.
Icon Class
Each value returned by Iterator will be an instance of the Icon class.
Each Icon will have the current properties available:
classCSS class of iconnameFormatted name of icon (i.e. Angle (Right) )unicodeUnicode representation of icon
Properties may be accessed by calling them directly upon the Icon class
(i.e. $icon->name).
Versioning
This library will be maintained under the Semantic Versioning guidelines.
Releases will be numbered with the following format:
<major>.<minor>.<patch>
And constructed with the following guidelines:
- Breaking backward compatibility bumps the major (and resets the minor and patch)
- New additions without breaking backward compatibility bumps the minor (and resets the patch)
- Bug fixes and misc changes bump the patch
Composer users who would like more granular control over upgrades should restrict their installation to patch updates only using this require key:
"bca/fontawesomeiterator": "1.0.*"
For more information on SemVer, please visit http://semver.org/.
bca/fontawesomeiterator 适用场景与选型建议
bca/fontawesomeiterator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 102.4k 次下载、GitHub Stars 达 13, 最近一次更新时间为 2013 年 12 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「iterator」 「FontAwesome」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 bca/fontawesomeiterator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bca/fontawesomeiterator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 bca/fontawesomeiterator 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
collection php library
PHP PDO Mysql select statement iterator implemented as multiple queries using LIMIT clauses
FontAwesome5 for Magento2
PHP class to add Font Awesome 5+'s SVG icons inline without Javascript.
Iteration tools for PHP
Sequential way to run Symfony Processes in parallel
统计信息
- 总下载量: 102.4k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 13
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-12-30