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

1.0.0 2016-08-14 00:04 UTC

This package is not auto-updated.

Last update: 2024-05-20 12:34:51 UTC


Source License Framework

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

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

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


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

Quick Overview

Full documenation @

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.

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.

/** @var \Laradic\IconGenerator\IconGenerator $generator */
$generator = (new \Laradic\IconGenerator\Factory)

$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')

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

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


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.


$generator = app('laradic.icon-generator')
// other code remains the same


Optionally, you could add the facade and use that for accessing the factory.

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


Another way to create fonts is using the command.

  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

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

  -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