2017 © Pedro Peláez
 

library octicons-php

A simple PHP library for displaying the Github Octicons font icons in svg format.

image

edwinhoksberg/octicons-php

A simple PHP library for displaying the Github Octicons font icons in svg format.

  • Thursday, April 26, 2018
  • by EdwinHoksberg
  • Repository
  • 1 Watchers
  • 1 Stars
  • 149 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 2029 % Grown

The README.md

Octicons-PHP Build Status Coverage Status Packagist

A simple PHP library for displaying the Github Octicons font icons in svg format., (*1)

Installation

Installation with composer:, (*2)

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., (*3)

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:, (*4)

vendor/bin/phpunit -c phpunit.dist.xml

License

MIT, (*5)

The Versions

26/04 2018

dev-master

9999999-dev

A simple PHP library for displaying the Github Octicons font icons in svg format.

  Sources   Download

MIT

The Requires

  • php >= 7.0

 

The Development Requires

github icons svg octicons

26/04 2018

1.0.0

1.0.0.0

A simple PHP library for displaying the Github Octicons font icons in svg format.

  Sources   Download

MIT

The Requires

  • php >= 7.0

 

The Development Requires

github icons svg octicons