PHP code example of alexazartsev / heroicon

1. Go to this page and download the library: Download alexazartsev/heroicon 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/ */

    

alexazartsev / heroicon example snippets


use AlexAzartsev\Heroicon\Heroicon;

Heroicon::make('Icon');

namespace App\Providers;

use AlexAzartsev\Heroicon\Heroicon;

class NovaServiceProvider extends NovaApplicationServiceProvider
{
    ...
    public function boot()
    {
        parent::boot();
        
        // to register set of icons globally, just specify folder with svg icons like this:
        // (icons should be located directly in specified folder in .svg format)
        // 'custom' icon set will be available for every Heroicon in your app
        Heroicon::registerGlobalIconSet('custom', 'Custom Icons', resource_path('img/icons'));
        // to pick default icon sets that will be available on field all over app use this:
        // default sets available: 'solid', 'outline', 'fa-brands', 'fa-regular', 'fa-solid'
        Heroicon::defaultIconSets(['solid', 'fa-brands', 'custom']);
        // to make svg editor disabled by default for every field use this:
        Heroicon::defaultEditorEnable(false);

    }

use AlexAzartsev\Heroicon\Heroicon;

Heroicon::make('Icon')->disableEditor();
Heroicon::make('Icon')->enableEditor();

use AlexAzartsev\Heroicon\Heroicon;

Heroicon::make('Icon')->registerIconSet('custom', 'Custom', resource_path('img/icons'));

use AlexAzartsev\Heroicon\Heroicon;

Heroicon::make('Icon')->only(['custom', 'solid']);
//for default sets you can use these methods:
Heroicon::make('Icon')->onlySolid();
Heroicon::make('Icon')->onlyOutline();
Heroicon::make('Icon')->onlyFaBrands();
Heroicon::make('Icon')->onlyFaSolid();
Heroicon::make('Icon')->onlyFaRegular();