PHP code example of teksite / icon-laravel

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

    

teksite / icon-laravel example snippets




return [

    'cache' => [
        'key' => 'svg_icons.icons',
        'enabled' => env('SVG_ICONS_CACHE_ENABLED', false),
        'ttl' => env('SVG_ICONS_CACHE_TTL', 2592000),
    ],

    'path' => [
        'solid' => public_path('vendor/icons/solid.json'),
        'outline' => public_path('vendor/icons/outline.json'),
    ],

    'component' => 'components.icon',

];

'path' => [
    'outline' => public_path('vendor/icons/outline.json'),
],

'path' => [
    'outline' => public_path('vendor/icons/outline.json'),
    'solid' => public_path('vendor/icons/solid.json'),
    'custom' => public_path('vendor/icons/custom.json'),
],

'component' => 'components.icon',

'component' => 'icons.svg',

[
    'path' => $path,
]

'component' => 'components.icon',

Teksite\IconLaravel\Service\IconManager

$iconManager = app(\Teksite\IconLaravel\Service\IconManager::class);

$icon = app(\Teksite\IconLaravel\Service\IconManager::class)
    ->getIcon('home');

$icon = app(\Teksite\IconLaravel\Service\IconManager::class)
    ->getIcon('home', type: 'solid');

$path = app(\Teksite\IconLaravel\Service\IconManager::class)
    ->getIcon(
        'home',
        type: 'outline',
        render: false
    );

$icon = app(\Teksite\IconLaravel\Service\IconManager::class)
    ->getIcon(
        'home',
        attributes: [
            'class' => 'w-6 h-6',
            'width' => 24,
            'height' => 24,
            'aria-hidden' => true,
        ]
    );

$exists = app(\Teksite\IconLaravel\Service\IconManager::class)
    ->hasIcon('home');

$exists = app(\Teksite\IconLaravel\Service\IconManager::class)
    ->hasIcon('home', 'solid');

$names = app(\Teksite\IconLaravel\Service\IconManager::class)
    ->getIconNames('outline');

$names = app(\Teksite\IconLaravel\Service\IconManager::class)
    ->getIconNames();

$icons = app(\Teksite\IconLaravel\Service\IconManager::class)
    ->getAll(render: false);

$icons = app(\Teksite\IconLaravel\Service\IconManager::class)
    ->getAll();

'cache' => [
    'enabled' => false,
],

'cache' => [
    'key' => 'svg_icons.icons',
    'enabled' => true,
    'ttl' => 2592000,
],

Teksite\IconLaravel\Support\CacheManager

\Teksite\IconLaravel\Support\CacheManager::clearCache();

use Teksite\IconLaravel\Support\CacheManager;

CacheManager::clearCache();

'path' => [
    'outline' => public_path('vendor/icons/outline.json'),
    'solid' => public_path('vendor/icons/solid.json'),
    'custom' => public_path('vendor/icons/custom.json'),
],

Blade::component('icon', Icon::class);
Blade::component('tkicon', TekIcon::class);

htmlspecialchars(
    $value,
    ENT_QUOTES | ENT_SUBSTITUTE,
    'UTF-8'
);
bash
php artisan vendor:publish --tag=icon-setting
bash
php artisan vendor:publish --tag=icon-assets
bash
php artisan vendor:publish --tag=icons-outline
php artisan vendor:publish --tag=icons-solid
php artisan vendor:publish --tag=icons-picker
text
config/icon-setting.php
text
config/icon-setting.php
text
config/icon-setting.php