avolle/cakephp-font-awesome 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

avolle/cakephp-font-awesome

Composer 安装命令:

composer require avolle/cakephp-font-awesome

包简介

FontAwesome plugin for CakePHP

README 文档

README

Create FontAwesome icons with a CakePHP helper

NB! FontAwesome scripts not included in plugin. You can use FontAwesome kits without downloading assets. See further down.

Version map:

Plugin Branch Cake PHP
2.x main 5.x ^8.1
1.x 1.x 4.x ^7.4 | ^8.0

Supports these Fonts:

  • Solid
  • Regular
  • Light
  • Thin
  • Duo
  • Brand
  • Sharp * through passing fa-sharp to class option

Installation

composer require avolle/cakephp-font-awesome

Usage

Add FontAwe helper to your AppView (src/View/AppView.php)

/**
 * Application View
 *
 * @property \Avolle\FontAwesome\View\Helper\FontAweHelper $FontAwe
 */
class AppView extends View
{
    public function initialize(): void
    {
        $this->loadHelper('Avolle/FontAwesome.FontAwe');
    }
}

Icons with title (optional)

echo $this->FontAwe->solid('receipt'); // <i class="fas fa-receipt"></i>
echo $this->FontAwe->regular('receipt', 'Title'); // <i class="far fa-receipt"></i> Title
echo $this->FontAwe->light('receipt'); // <i class="fal fa-receipt"></i>
echo $this->FontAwe->duo('receipt'); // <i class="fad fa-receipt"></i>
echo $this->FontAwe->brand('github'); // <i class="fab fa-github"></i>
echo $this->FontAwe->thin('receipt'); // <i class="fat fa-receipt"></i>

Alternatively: Icons with title (optional)

echo $this->FontAwe->icon('fas', 'receipt'); // <i class="fas fa-receipt"></i>
echo $this->FontAwe->icon('far', 'receipt', 'Title'); // <i class="far fa-receipt"></i> Title
echo $this->FontAwe->icon('fal', 'receipt'); // <i class="fal fa-receipt"></i>
echo $this->FontAwe->icon('fad', 'receipt'); // <i class="fad fa-receipt"></i>
echo $this->FontAwe->icon('fab', 'github'); // <i class="fab fa-github"></i>
echo $this->FontAwe->icon('fat', 'receipt'); // <i class="fat fa-receipt"></i>

echo $this->FontAwe->icon(FontAweHelper::SOLID, 'receipt'); // <i class="fas fa-receipt"></i>
echo $this->FontAwe->icon(FontAweHelper::REGULAR, 'receipt', 'Title'); // <i class="far fa-receipt"></i> Title
echo $this->FontAwe->icon(FontAweHelper::LIGHT, 'receipt'); // <i class="fal fa-receipt"></i>
echo $this->FontAwe->icon(FontAweHelper::DUO, 'receipt'); // <i class="fad fa-receipt"></i>
echo $this->FontAwe->icon(FontAweHelper::BRAND, 'github'); // <i class="fab fa-github"></i>
echo $this->FontAwe->icon(FontAweHelper::THIN, 'receipt'); // <i class="fat fa-receipt"></i>

Links with icon

// Use string urls
echo $this->FontAwe->solidLink('receipt', '/some-url'); // <a href="/some-url"><i class="fas fa-receipt"></i></a>
// Use router urls
echo $this->FontAwe->regularLink('receipt', ['controller' => 'Icons', 'action' => 'index']); // <a href="/icons"><i class="far fa-receipt"></i></a>
// Add a title after the icon
echo $this->FontAwe->lightLink('receipt', '/some-url/', 'Icons'); // <a href="/some-url"><i class="fal fa-receipt"></i> Icons</a>
// Add a class to the icon (not anchor element)
echo $this->FontAwe->duoLink('receipt', '/some-url/', 'Icons', ['icon' => ['class' => 'text-success']]); // <a href="/some-url"><i class="fad fa-receipt text-success"></i> Icons</a>

Using the sharp styling

// Icon
echo $this->FontAwe->solid('receipt', null, ['class' => 'fa-sharp']); // <i class="fas fa-receipt fa-sharp"></i>
// Link
echo $this->FontAwe->solidLink('receipt', '/some-url/', null, ['icon' => ['class' => 'fa-sharp']]); // <a href="/some-url"><i class="fas fa-receipt fa-sharp"></i></a>

Load a FontAwesome kit script

echo $this->FontAwe->scriptKit('3247824fdhufhd'); //<script src="https://kit.fontawesome.com/3247824fdhufhd.js" crossorigin="anonymous"></script>

Load a FontAwesome script (not a kit, but either downloaded or CDN)

echo $this->FontAwe->script(); //<script src="/js/all.js"></script>
echo $this->FontAwe->script('font-awesome'); //<script src="/js/font-awesome.js"></script>
echo $this->FontAwe->script('all', 'font-awesome/'); //<script src="/js/font-awesome/all.js"></script>

avolle/cakephp-font-awesome 适用场景与选型建议

avolle/cakephp-font-awesome 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.85k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 06 月 07 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「cakephp」 「FontAwesome」 「cakephp-plugin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 avolle/cakephp-font-awesome 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 avolle/cakephp-font-awesome 我们能提供哪些服务?
定制开发 / 二次开发

基于 avolle/cakephp-font-awesome 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 2.85k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 11
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-06-07