PHP code example of digbang / fonts

1. Go to this page and download the library: Download digbang/fonts library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

digbang / fonts example snippets


'providers' => [
    // ...
    Digbang\Fonts\FontsServiceProvider::class,
    
],

'aliases' => [
    // ...
    'Fonts' => Digbang\Fonts\Facade::class,
],

// The `icon` function will use the configured icon prefix (defaults to "fa")
Fonts::icon('icon', 'extra-class') // <i class="fa fa-icon extra-class"></i>

Fonts::fa()->icon('icon', ['class' => 'extra-class']) // <i class="fa fa-icon extra-class"></i>
Fonts::mat()->icon('icon', ['class' => 'extra-class']) // <i class="zmdi zmdi-icon extra-class"></i>

icon('foo'); // <i class="fa fa-foo"></i>
fa('icon', 'extra-class') // <i class="fa fa-icon extra-class"></i>
mat('icon', ['class' => 'extra-class']) // <i class="mat mat-icon extra-class"></i>

fa('times', ['title' => 'Delete this!']) // <i class="fa fa-times" title="Delete this!"></i>

fa('times', 'text-hide')->withContent("Remove element");

// FontAwesome stacks
fa('stack', 'fa-lg')->withContent(
    fa('circle', 'fa-stack-2x') .
    fa('flag', 'fa-stack-1x fa-inverse')
);

// Setting a new default tag to all fonts
Fonts::setDefaultTag('span');
fa('edit'); // <span class="fa fa-edit"></span>

// Setting a tag on each use
Fonts::fa()->withTag('span')->icon('times'); // <span class="fa fa-times"></span>

Fonts::macro('digbang', function () {
    return $this->create('db');
});

Fonts::digbang()->icon('foo'); // <i class="db db-foo"></i>

$fonts = new Digbang\Fonts\Factory('fa');
$fonts->setDefaultTag('span');

$fonts->icon('times', 'text-danger'); // <span class="fa fa-times text-danger"></span>
$fonts->mat()->icon('times', 'text-danger'); // <span class="mat mat-times text-danger"></span>

php artisan vendor:publish --provider Digbang\\Fonts\\FontsServiceProvider