定制 laradic/icon-generator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

laradic/icon-generator

Composer 安装命令:

composer require laradic/icon-generator

包简介

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

README 文档

README

Laradic Icon Generator

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.

Installation

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

Quick Overview

Full documenation @ la.radic.nl

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

(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.

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.

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

Command

Another way to create fonts is using the command.

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固