PHP code example of vigstudio / laravel-tabler-icons

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

    

vigstudio / laravel-tabler-icons example snippets


{{ tabler_icon('arrow-forward-up') }}
{{ tabler_icon('arrow-merge-alt-left') }}
{{ tabler_icon('arrow-left-circle') }}
{{ tabler_icon('2fa') }}

// Method 1: Facade (Recommended)
{!! TablerIcon::home() !!}
{!! TablerIcon::user(['class' => 'text-blue-500']) !!}
{!! TablerIcon::album() !!}
{!! TablerIcon::brandGithub() !!}

// Method 2: Using helper function
{!! tabler_icon('home') !!}
{!! tabler_icon('user', ['class' => 'text-blue-500']) !!}
{!! tabler_icon('album') !!}

// Method 3: Using global helper (without attributes)
{!! TablerIcon()::home() !!}
{!! TablerIcon()::album() !!}

// Method 4: Through app container
{!! app('tabler-icon')::home() !!}
{!! app('tabler-icon')::user(['class' => 'text-blue-500']) !!}

// Render an icon (multiple ways)
TablerIcon::home(['class' => 'icon', 'style' => 'color: red;'])
TablerIcon::album()
tabler_icon('home', ['class' => 'icon'])
TablerIcon()::home() // Note: global helper doesn't support attributes

// Check if icon exists
TablerIcon::exists('home') // returns bool
TablerIcon::exists('album') // returns bool

// Get all available icons
TablerIcon::all() // returns array (6000+ icons)

// Search for icons
TablerIcon::search('user') // returns array of matching icons
TablerIcon::search('brand') // returns array of brand icons

// ✅ Works - Facade with attributes
{!! TablerIcon::user(['class' => 'w-8 h-8 text-blue-500']) !!}
{!! TablerIcon::home(['style' => 'color: red; width: 32px;']) !!}

// ✅ Works - Helper with attributes
{!! tabler_icon('user', ['class' => 'icon-user', 'data-id' => '123']) !!}

// ❌ Doesn't work - Global helper doesn't support attributes
{!! TablerIcon()::user(['class' => 'test']) !!} // Attributes ignored

// ✅ Alternative - Use Blade component for attributes
<x-tabler-icons::user class="w-8 h-8 text-blue-500" />