2017 © Pedro Peláez
 

library font-awesome-5-lite

A PHP library that generates Font Awesome 5 (Pro and Free) SVG JS files and stores them in a cache.

image

innovato/font-awesome-5-lite

A PHP library that generates Font Awesome 5 (Pro and Free) SVG JS files and stores them in a cache.

  • Friday, March 23, 2018
  • by innovato
  • Repository
  • 2 Watchers
  • 0 Stars
  • 15 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 25 % Grown

The README.md

Font Awesome 5 Lite

This PHP library generates Font Awesome 5 (Pro and Free) SVG JS files and stores them in a cache. It only generates the icons that you need! It's useful for those who don't want to use third party CDN's or WebPack., (*1)

Due to possible copyright infringements you need to download the latest Font Awesome yourself and add it to the files/fa_source folder., (*2)

Quick start

Several quick start options are available:, (*3)

Get the Font Awesome 5 source files (required)

Get the Font Awesome 5 source files from their official website (https://fontawesome.com/). It's up to you to whether you want to use the Free or Pro version. They're both compatible with this library., (*4)

After the download you need to place the content of the Font Awesome svg-with-js/js folder in to the files/fa_source directory (or use your own assets directory)., (*5)

If you choose to use your own assets directory, then make sure there's a subfolder called "fa_source" with the SVG JS files and also make sure the names are compatible., (*6)

Basic usage

With default settings

<?php

include '../src/falite.php';

$faLite = new Innovato\FaLite();

$faLite->execute($_GET['icons']);

With all options

<?php

include '../src/falite.php';

$faLite = new Innovato\FaLite();

$faLite->cacheEnabled = true; // Default true
$faLite->cacheDirectory = '../files/cache';
$faLite->filesDirectory = '../files';
$faLite->types = [
    'fab' => 'fa-brands',
    'fal' => 'fa-light',
    'far' => 'fa-regular',
    'fas' => 'fa-solid'
];
$faLite->execute($_GET['icons']);

Webserver configuration examples (optional)

You can use Nginx's rewrite to create a rule to make it look like it's a legit JS file. For example:, (*7)

server {
    ...

    rewrite ^/font-awesome-lite\.js$  /examples/example_minimal.php;

    ...
}

Or use Apache's mod_rewrite method:, (*8)

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^example_minimal\.php$ /font-awesome-lite.js?&%{QUERY_STRING}
</IfModule>

Adding Font Awesome Lite in your template

Add the generator URL to your HTML (use your own URL and path of course):, (*9)

<script src="https://yourwebsite.com/assets/font-awesome-lite.js?icons=fab innovato, fas arrow-left"></script>

Options

Name Type Description
cacheEnabled boolean This enables caching JS files [Default: true]
cacheDirectory string Full path to caching directory [Default: files/cache]
filesDirectory string Full path to files directory [Default: files]
types array The types and files to use [Default: [ 'fab' => 'fa-brands', 'fal' => 'fa-light', 'far' => 'fa-regular', 'fas' => 'fa-solid' ]]

Credits

A big thanks to Font Awesome for the awesome SVG icons!, (*10)

Code and documentation copyright 2018 Innovato. Code released under the MIT License., (*11)

The Versions

23/03 2018

dev-master

9999999-dev https://github.com/innovato/font-awesome-5-lite

A PHP library that generates Font Awesome 5 (Pro and Free) SVG JS files and stores them in a cache.

  Sources   Download

MIT

The Requires

  • php-64bit >=7.0

 

by Avatar innovato

font awesome font awesome lite font awesome cdn

23/03 2018

0.2

0.2.0.0 https://github.com/innovato/font-awesome-5-lite

A PHP library that generates Font Awesome 5 (Pro and Free) SVG JS files and stores them in a cache.

  Sources   Download

MIT

The Requires

  • php-64bit >=7.0

 

by Avatar innovato

font awesome font awesome lite font awesome cdn

23/03 2018

0.1.4

0.1.4.0 https://github.com/innovato/font-awesome-5-lite

A PHP library that generates Font Awesome 5 (Pro and Free) SVG JS files and stores them in a cache.

  Sources   Download

MIT

The Requires

  • php-64bit >=7.0

 

by Avatar innovato

font awesome font awesome lite font awesome cdn

22/03 2018

0.1.3

0.1.3.0 https://github.com/innovato/font-awesome-5-lite

A PHP library that generates Font Awesome 5 (Pro and Free) SVG JS files and stores them in a cache.

  Sources   Download

MIT

The Requires

  • php-64bit >=7.0

 

by Avatar innovato

font awesome font awesome lite font awesome cdn

22/03 2018

0.1.2

0.1.2.0 https://github.com/innovato/font-awesome-5-lite

A PHP library that generates Font Awesome 5 (Pro and Free) SVG JS files and stores them in a cache.

  Sources   Download

MIT

The Requires

  • php-64bit >=7.0

 

by Avatar innovato

font awesome font awesome lite font awesome cdn

20/03 2018

0.1.1

0.1.1.0 https://github.com/innovato/font-awesome-5-lite

A PHP library that generates Font Awesome 5 (Pro and Free) SVG JS files and stores them in a cache.

  Sources   Download

MIT

The Requires

  • php-64bit >=7.0

 

by Avatar innovato

font awesome font awesome lite font awesome cdn