2017 © Pedro Peláez
 

library icon-generator

Generate FontAwesome, Foundation Icons or any custom icon font icons to multiple size and color image files like .ico/.png

image

laradic/icon-generator

Generate FontAwesome, Foundation Icons or any custom icon font icons to multiple size and color image files like .ico/.png

  • Sunday, March 4, 2018
  • by radic
  • Repository
  • 1 Watchers
  • 2 Stars
  • 13 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 8 % Grown

The README.md

Laradic Icon Generator

Source License Framework, (*1)

Laradic Icon Generator can create PNG images from several icon fonts like FontAwesome, Foundation Icons, etc. For example, useful for favicon generation., (*2)

This package does not require Laravel but it does provide a ServiceProvider, Facade access and a Console command., (*3)

The package follows the FIG standards PSR-1, PSR-2, and PSR-4 to ensure a high level of interoperability between shared PHP code., (*4)

Installation

composer require "laradic/icon-generator:~1.0"

Quick Overview

Full documenation @ la.radic.nl, (*5)

Using the API

The factory is the place where you can register custom fonts. Laradic Icon Generator comes packed with Font Awesome and Foundation Icons., (*6)

When the font you want to use has been added to the factory you can create a IconGenerator for it which is responsible for generating the images., (*7)

/** @var \Laradic\IconGenerator\IconGenerator $generator */
$generator = (new \Laradic\IconGenerator\Factory)
                ->addDefaultFonts()
                ->createGenerator('font-awesome');

$generator->setIcons('android', 'car')
            ->setSizes(16, 32, 64, 128)
            ->addColor('#42A5F5') // blue 400
            ->addColor('#424242') // grey 800
            ->addColor(251, 94, 11) // RGB Also supported
            ->setOutDir(__DIR__ . '/generated-icons')
            ->generate();

There's also a shorthand method available \Laradic\IconGenerator\Factory::generate($font, array $icons, array $sizes, array $colors, $outDir = null), (*8)

(new Factory())
    ->addDefaultFonts()
    ->generate($font, array $icons, array $sizes, array $colors, $outDir = null);

Laravel

When using the Laravel Service Provider, the factory is bound as singleton in the container. So the example above can also be written like this., (*9)

Binding

$generator = app('laradic.icon-generator')
                ->addDefaultFonts()
                ->createGenerator('font-awesome');
// other code remains the same

Facade

Optionally, you could add the facade and use that for accessing the factory., (*10)

$generator = IconGenerator::addDefaultFonts()->createGenerator('font-awesome');

Command

Another way to create fonts is using the command., (*11)

Usage:
  laradic:icon:generate [options] [--] <font> [<outDir>]
  laradic:icon:generate font-awesome ./ -i car -i book -s 16 -s 32 -s 128 -c 424242 -c 42A5F5

Arguments:
  font                  The icon font you would like to use
  outDir                Path to the directory the icons should be generated in. [default: "resources/assets/icons"]

Options:
  -i, --icons=ICONS     Icons to generate. One or more icon names (multiple values allowed)
  -s, --sizes=SIZES     The sizes to generate. One or more numeric values (multiple values allowed)
  -c, --colors=COLORS   The colors to generate. Either RGB or HEX (multiple values allowed)
  -l, --list            List all available fonts

The Versions

04/03 2018

dev-master

9999999-dev https://la.radic.nl

Generate FontAwesome, Foundation Icons or any custom icon font icons to multiple size and color image files like .ico/.png

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel generator icon foundation icons font-awesome fontawesome foundation-icons laradic

14/08 2016

1.0.0

1.0.0.0 https://la.radic.nl

Generate FontAwesome, Foundation Icons or any custom icon font icons to multiple size and color image files like .ico/.png

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel generator icon foundation icons font-awesome fontawesome foundation-icons laradic