edwinhoksberg/octicons-php
最新稳定版本:v1.1.1
Composer 安装命令:
composer require edwinhoksberg/octicons-php
包简介
A simple PHP library for displaying the Github Octicons font icons in svg format.
关键字:
README 文档
README
A simple PHP library for displaying the Github Octicons font icons in svg format.
Installation
Installation with composer:
composer require edwinhoksberg/octicons-php
Usage
<?php use Octicons\Octicon; use Octicons\Options; // The shortcut method: echo Octicon::gear(); // or with options: echo Octicon::gear([ 'classes' => ['bla', 'test-con'], 'ratio' => 8 ]); // The extended method: $octicon = new Octicon(); $icon = $octicon->icon('gear'); echo 'Icon name: '.$icon->getName(); // gear echo 'Icon width: '.$icon->getWidth(); // 14 echo 'Icon height: '.$icon->getHeight(); // 16 echo 'Icon ratio: '.$icon->getRatio(); // 1 echo $icon->toSvg(); // and with custom options: $octicon = new Octicon(); $options = new Options(); // add extra css classes: $options->addClass('background-color'); $options->addClass(['color-blue', 'extra-class']); // change the icon size: $options->setRatio(2); $icon = $octicon->icon('gear', $options); echo 'Icon width: '.$icon->getWidth(); // 28 echo 'Icon height: '.$icon->getHeight(); // 32 echo $icon->toSvg();
Twig Extension
A simple twig function is available for those who are using the Twig templating library.
Display an icon: {{ octicon("gear") }}
Display an icon with extra css classes: {{ octicon("gear", 'background-red') }}
Display an extra large icon: {{ octicon("gear", '', 2) }}
Tests
Run the unit tests with PHPUnit:
vendor/bin/phpunit -c phpunit.dist.xml
License
统计信息
- 总下载量: 2.61k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-04-26