ioroot / fontawesome-generator
Faker extension for randomly picking a FontAwesome Icon
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 528
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Type:project
Requires
Requires (Dev)
This package is not auto-updated.
Last update: 2019-09-29 03:33:16 UTC
README
Faker extension for randomly picking a FontAwesome (4.7.0) icon.
Faker Extension
An extension of the fzaninotto/Faker PHP Library. This has two functions that will either return a random icon name or the entire array of names.
The library contains all of FontAwesome's Library.
Installation
composer require ioroot/fontawesomegenerator
Alternatively, add to your composer.json file with:
"require": { "ioroot/fontawesomegenerator": "v0.0.1" }
Usage
Use the FontAwesomeGeneratorProvider
class in combination with Faker to produce the random font name:
<?php
require __DIR__ .'/vendor/autoload.php';
use faker\provider\FontAwesomeGeneratorProvider;
$faker = Faker\Factory::create();
$faker->addProvider(new FontAwesomeGeneratorProvider($faker));
$colour = $faker->fontAwesomeIcon();
?>
<i style="font-size:200px" class="fa <?php echo $icon; ?>" aria-hidden="true"></i>
This will generate an i tag with a random fontawesome icon.
Example index file
Within the vendor/ioroot/fontawesomegenerator/ folder you will find an index.php file which can be moved to your root directory and will provide an example of both functions.
Tests
There are two PHPUnit tests that will check that the library will return a correct FontAwesome name value and that it is contained within the 4.7.0 library.