### Example Configuration File Content Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/installation-guide.md This is an example of the content found in the published `config/blade-tabler-icons.php` file, showing customizable options. ```php 'prefix' => 'tabler', // Fallback icon when icon not found 'fallback' => 'section', // Default CSS classes for all icons 'class' => 'inline-block', // Default SVG attributes 'attributes' => [ 'width' => 24, 'height' => 24, ], ]; ``` -------------------------------- ### Complete Example Configuration Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/configuration.md A comprehensive example of the configuration file, demonstrating how to set prefix, fallback, default classes, and default attributes. ```php 'tabler', 'fallback' => 'section', 'class' => 'inline-block align-middle transition-colors duration-200', 'attributes' => [ 'width' => 24, 'height' => 24, 'stroke-width' => 2, 'role' => 'img', ], ]; ``` -------------------------------- ### Example Configuration Array Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/public-api.md This array shows an example of how to configure the package's prefix, fallback icon, default classes, and default attributes. ```php [ 'prefix' => 'tabler', 'fallback' => 'section', 'class' => 'inline-block', 'attributes' => [ 'width' => 24, 'height' => 24, ], ] ``` -------------------------------- ### Example with Inline Styles Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/README.md Demonstrates applying inline styles directly to an icon component. ```blade ``` -------------------------------- ### Button with Icon Example Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/installation-guide.md Demonstrates creating a button with an icon and text, using flexbox for alignment and spacing. ```blade ``` -------------------------------- ### Form Input with Icon Example Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/installation-guide.md Demonstrates how to integrate an icon into a form input field for visual cues, such as a search icon. ```blade
``` -------------------------------- ### Install Blade Tabler Icons Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/README.md Install the package using Composer. Ensure your project meets the PHP and Laravel version requirements. ```bash composer require secondnetwork/blade-tabler-icons ``` -------------------------------- ### Verify Package Installation Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/installation-guide.md Check if the Blade Tabler Icons package has been successfully installed by running this Composer command. ```bash composer show secondnetwork/blade-tabler-icons ``` -------------------------------- ### Helper Function Usage Example Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/GENERATION_SUMMARY.txt Shows how to use the svg() helper function to render an icon with specified classes and attributes. ```php 'icon-123']) ?> ``` -------------------------------- ### List Available Icons (Local SVG Directory) Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/icons-list.md Command to list all available SVG icons in the local resources directory after installation. ```bash ls resources/svg/ ``` -------------------------------- ### Badge with Icon Example Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/installation-guide.md Shows how to create a badge with an icon and text, using Tailwind CSS for styling to indicate status. ```blade Active ``` -------------------------------- ### Configuration Option: Prefix Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/GENERATION_SUMMARY.txt Example of setting the 'prefix' configuration option. This option defines the prefix for all Tabler icon components. ```php 'prefix' => 'custom-icon' ``` -------------------------------- ### Icon Naming Convention Examples Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/icons-list.md Illustrates the conversion of SVG filenames to kebab-case component names, including handling of filled and short-suffix variants. ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` -------------------------------- ### Navigation Link with Icon Example Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/installation-guide.md Illustrates creating a navigation link that includes an icon and text, with hover effects for better user feedback. ```blade Settings ``` -------------------------------- ### Example of assertStringMatchesFormat Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/test-details.md Demonstrates the usage of assertStringMatchesFormat for comparing HTML strings, highlighting its ability to ignore attribute order differences. ```PHP $this->assertStringMatchesFormat( 'content', 'content' ); // Passes even though attribute order differs ``` -------------------------------- ### Configuration Option: Fallback Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/GENERATION_SUMMARY.txt Example of setting the 'fallback' configuration option. This option specifies the default icon to use when a requested icon is not found. ```php 'fallback' => 'alert-circle' ``` -------------------------------- ### Alert Box with Icon Example Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/installation-guide.md Shows how to create an alert box with an icon and message, using Tailwind CSS for styling and layout. ```blade

Your message here

``` -------------------------------- ### PHPUnit Assertion Methods Example Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/test-details.md Provides examples of common PHPUnit assertion methods used for validating test outcomes, such as string comparisons and boolean checks. ```PHP $this->assertStringMatchesFormat($expected, $actual); $this->assertStringContainsString('svg', $result); $this->assertTrue($condition); ``` -------------------------------- ### Configuration Option: Class Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/GENERATION_SUMMARY.txt Example of setting the 'class' configuration option. This option defines default CSS classes to be applied to all rendered icons. ```php 'class' => 'w-6 h-6' ``` -------------------------------- ### Configuration Option: Attributes Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/GENERATION_SUMMARY.txt Example of setting the 'attributes' configuration option. This option defines default HTML attributes to be applied to all rendered icons. ```php 'attributes' => ['data-bs-toggle' => 'tooltip'] ``` -------------------------------- ### Blade Icons Integration Example Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/architecture.md Demonstrates how the BladeTablerIconsServiceProvider registers the Tabler icon set with the Blade Icons Factory after it has been resolved. ```php $this->callAfterResolving(Factory::class, function (Factory $factory, Container $container) { $factory->add('tabler', array_merge(['path' => __DIR__.'/../resources/svg'], $config)); }); ``` -------------------------------- ### Blade Component Usage Example Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/GENERATION_SUMMARY.txt Demonstrates how to use Blade components for rendering Tabler icons. Supports outline and filled variants. ```blade ``` -------------------------------- ### SVG Directive Usage Example Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/GENERATION_SUMMARY.txt Illustrates the usage of the @svg directive for rendering icons with custom classes and attributes. ```blade @svg('tabler-activity', 'text-red-500', ['data-testid' => 'activity-icon']) ``` -------------------------------- ### Using Icons in Blade Templates Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/public-api.md All icons are immediately available in Blade templates after installation. No import or manual registration is required. ```blade @svg('tabler-alert-circle') ``` -------------------------------- ### Getting HTML String from svg() Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/public-api.md Call the toHtml() method on the SVG object returned by the svg() function to get the raw HTML string of the icon. ```php $html = svg('tabler-alert-circle')->toHtml(); ``` -------------------------------- ### Usage of Published SVG Assets Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/installation-guide.md Example of how to use a published SVG icon file directly in an HTML `` tag, referencing the asset path. ```blade ``` -------------------------------- ### Registering Icon Set with Configuration Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/architecture.md Shows how the package merges configuration with the icon set path during the service provider's registration phase. This allows for customization of icon sources. ```php $factory->add('tabler', array_merge(['path' => __DIR__.'/../resources/svg'], $config)); ``` -------------------------------- ### Recommended Production Configuration Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/installation-guide.md Sets recommended configuration values for caching and default icon settings in a production environment. ```php // config/blade-icons.php return [ 'cache' => true, 'cache_path' => 'resources/cache/blade-icons', ]; // config/blade-tabler-icons.php return [ 'prefix' => 'tabler', 'fallback' => 'section', 'class' => '', // Adjust based on needs 'attributes' => [], ]; ``` -------------------------------- ### List First 20 Icons Locally Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/installation-guide.md Lists the first 20 SVG icon files in the resources/svg/ directory. ```bash ls resources/svg/ | grep -E '\.svg$' | head -20 ``` -------------------------------- ### BladeTablerIconsServiceProvider boot() Method Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/BladeTablerIconsServiceProvider.md Publishes package assets for use in the Laravel application when running in console mode. ```php public function boot(): void ``` -------------------------------- ### Run Tests Command Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/installation-guide.md Executes the package's tests using PHPUnit. ```bash ./vendor/bin/phpunit ``` -------------------------------- ### Publish SVG Assets for Direct Serving Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/icons-list.md Make SVG icon files available in the public directory for direct use with `` tags. This is done by publishing the package's assets. ```bash php artisan vendor:publish --tag=blade-tabler-icons ``` -------------------------------- ### List Available Icons (Published Assets) Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/icons-list.md Command to list all available SVG icons in the public vendor directory after publishing assets. ```bash ls public/vendor/blade-tabler-icons/ ``` -------------------------------- ### Use Icons in Multiple Ways Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/README.md Demonstrates various methods to use icons, including Blade components, the @svg() directive, PHP helper, and raw SVG assets. ```blade @svg('tabler-bell', 'w-6 h-6') {{ svg('tabler-bell', 'w-6 h-6')->toHtml() }} ``` -------------------------------- ### Publish Configuration File Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/README.md Publish the configuration file to customize default classes, attributes, and other Blade Icons features. ```bash php artisan vendor:publish --tag=blade-tabler-icons-config ``` -------------------------------- ### Chaining @svg() Directive Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/icon-components.md Use the `toHtml()` method on the @svg() directive to get the raw HTML string of an icon. This is useful for combining with other Blade operations or when direct output is not desired. ```blade {{ svg('tabler-alert-circle')->toHtml() }} ``` -------------------------------- ### Environment-Specific Configuration Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/configuration.md Customize icon configuration based on the environment using .env variables. This allows for different prefixes or fallbacks in development versus production. ```bash # .env ICON_PREFIX=custom-tabler ICON_FALLBACK=help ``` ```php // config/blade-tabler-icons.php return [ 'prefix' => env('ICON_PREFIX', 'tabler'), 'fallback' => env('ICON_FALLBACK', 'section'), ]; ``` -------------------------------- ### Artisan Commands Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/public-api.md Utilize Artisan commands to publish package assets and configuration files. ```APIDOC ## Artisan Commands ### Description Utilize Artisan commands to publish package assets and configuration files. ### Publishing Configuration ```bash php artisan vendor:publish --tag=blade-tabler-icons-config ``` **Tag**: `blade-tabler-icons-config` **Effect**: Creates a publishable configuration file that you can customize. ### Publishing SVG Assets ```bash php artisan vendor:publish --tag=blade-tabler-icons ``` **Tag**: `blade-tabler-icons` **Effect**: Copies all icon SVG files to the public directory for direct asset access. ``` -------------------------------- ### Service Provider Configuration Integration Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/configuration.md Understand how the service provider integrates configuration with the Blade Icons factory. The `path` points to the SVG directory, and merged configuration options are passed to Blade Icons. ```php $factory->add('tabler', array_merge( ['path' => __DIR__.'/../resources/svg'], $config )); ``` -------------------------------- ### List All Available Icons Programmatically Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/icons-list.md Discover all available SVG icons by scanning the resource directory. This is useful for dynamic icon selection or building icon management tools. ```php $icons = collect(scandir(resource_path('svg'))) ->filter(fn($file) => str_ends_with($file, '.svg')) ->map(fn($file) => substr($file, 0, -4)) // Remove .svg ->sort() ->values(); ``` -------------------------------- ### Project Structure Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/architecture.md Illustrates the directory layout of the blade-tabler-icons package, showing the location of source files, configuration, resources, and tests. ```tree blade-tabler-icons/ ├── src/ │ └── BladeTablerIconsServiceProvider.php # Service provider (main class) ├── config/ │ ├── blade-tabler-icons.php # Configuration file │ └── generation.php # Icon generation config ├── resources/ │ └── svg/ # 7,200+ SVG icon files ├── tests/ │ └── CompilesIconsTest.php # Test suite ├── composer.json # PHP package metadata ├── package.json # npm dependencies ├── README.md # Documentation └── LICENSE.md # MIT license ``` -------------------------------- ### Test Dependencies: composer.json Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/test-details.md Lists the required development packages for testing, including Orchestra Testbench and PHPUnit, as specified in the composer.json file. ```json "require-dev": { "orchestra/testbench": "^6.0|^7.0|^9.0|^10.0", "phpunit/phpunit": "^9.0|^10.0|^11.0|^12.0" } ``` -------------------------------- ### Enable Verbose Output in PHPUnit Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/test-details.md Shows detailed output for each test case executed by PHPUnit. Use the -v flag for more granular feedback during test runs. ```bash ./vendor/bin/phpunit -v ``` -------------------------------- ### Implement Responsive Icon Sizing with Tailwind CSS Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/icons-list.md Control icon size dynamically across different screen sizes using Tailwind CSS utility classes for a responsive design. ```blade ``` -------------------------------- ### Accessing Configuration Values Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/configuration.md Retrieve configuration values using Laravel's config helper. This is useful for dynamically setting icon prefixes, fallbacks, classes, or attributes. ```php $prefix = config('blade-tabler-icons.prefix'); // 'tabler' $fallback = config('blade-tabler-icons.fallback'); // 'section' $classes = config('blade-tabler-icons.class'); // '' $attributes = config('blade-tabler-icons.attributes'); // [] ``` -------------------------------- ### Composer JSON for Auto-Discovery Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/architecture.md Shows the 'extra' configuration in composer.json that enables automatic discovery of the package's service provider by Laravel. ```json "extra": { "laravel": { "providers": [ "secondnetwork\TablerIcons\BladeTablerIconsServiceProvider" ] } } ``` -------------------------------- ### Run Specific Test Method with PHPUnit Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/test-details.md Executes a single, specific test method within a PHP file. Use the --filter option followed by the method name. ```bash ./vendor/bin/phpunit tests/CompilesIconsTest.php --filter it_compiles_a_single_anonymous_component ``` -------------------------------- ### Run Specific Test File with PHPUnit Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/test-details.md Runs only the tests located within a specified PHP file. This is useful for focusing on a particular set of tests. ```bash ./vendor/bin/phpunit tests/CompilesIconsTest.php ``` -------------------------------- ### Publish Raw SVG Icons Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/README.md Publish all raw SVG icon assets to your public vendor directory for use as image assets. ```bash php artisan vendor:publish --tag=blade-tabler-icons --force ``` -------------------------------- ### Configuration Access Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/public-api.md Access package configuration options using Laravel's `config()` helper function. ```APIDOC ## Configuration Access ### Description Access package configuration options using Laravel's `config()` helper function. ### Access Method ```php config('blade-tabler-icons') config('blade-tabler-icons.prefix') config('blade-tabler-icons.fallback') config('blade-tabler-icons.class') config('blade-tabler-icons.attributes') ``` ### Configuration Options | Key | Type | Default | Description | |---|---|---|---| | `prefix` | string | `'tabler'` | Component prefix for `` | | `fallback` | string | `'section'` | Icon name to use when icon not found | | `class` | string | `''` | Default CSS classes for all icons | | `attributes` | array | `[]` | Default SVG attributes for all icons | ### Example Configuration ```php [ 'prefix' => 'tabler', 'fallback' => 'section', 'class' => 'inline-block', 'attributes' => [ 'width' => 24, 'height' => 24, ], ] ``` ``` -------------------------------- ### Configure Icon Prefix Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/configuration.md Set the prefix for component names and the @svg() directive. This helps prevent naming conflicts when using multiple icon sets. ```php 'prefix' => 'tabler', ``` -------------------------------- ### Configure Fallback Icon Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/configuration.md Specify the icon name to display when a requested icon is not found. This ensures graceful degradation and prevents template errors. ```php 'fallback' => 'section', ``` -------------------------------- ### Basic svg() Function Usage Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/public-api.md Use the svg() function to render an icon by its name. Ensure the 'tabler-' prefix is included. ```php echo svg('tabler-alert-circle'); ``` -------------------------------- ### Register Custom Icon Set Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/architecture.md Register a new custom icon set by providing its name and path to the Factory instance. This allows you to use custom icons with a specific prefix. ```php // In a service provider $this->callAfterResolving(Factory::class, function (Factory $factory) { $factory->add('custom', [ 'path' => resource_path('icons/custom'), ]); }); ``` -------------------------------- ### Publish Tabler Icons Assets and Configuration Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/BladeTablerIconsServiceProvider.md Use these Artisan commands to publish the SVG icon files or the configuration file to your Laravel project. ```bash # Publish icon SVG assets php artisan vendor:publish --tag=blade-tabler-icons # Publish configuration file php artisan vendor:publish --tag=blade-tabler-icons-config # Publish both (with force overwrite) php artisan vendor:publish --tag=blade-tabler-icons --force ``` -------------------------------- ### Use Filled Icon Variants Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/installation-guide.md Demonstrates two ways to render filled versions of icons using either a '-filled' or '-f' suffix. ```blade ``` -------------------------------- ### Count Total Icons Locally Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/installation-guide.md Counts the total number of SVG icon files in the resources/svg/ directory. ```bash ls resources/svg/ | grep -E '\.svg$' | wc -l ``` -------------------------------- ### BladeTablerIconsServiceProvider registerConfig() Method Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/BladeTablerIconsServiceProvider.md Internal method that merges the default configuration file for Tabler Icons. ```php private function registerConfig(): void ``` -------------------------------- ### Compile Basic Anonymous Icon Component Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/test-details.md Verifies that a single, basic icon component compiles to its correct SVG HTML representation. It checks for correct namespaces, classes, dimensions, and attributes. ```php /** @test */ public function it_compiles_a_single_anonymous_component() { $result = svg('tabler-accessible')->toHtml(); $expected = <<<'SVG' SVG; $this->assertStringMatchesFormat($result, $expected); } ``` -------------------------------- ### Test Inline Style Application Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/test-details.md Verifies that inline styles passed to icons are properly applied using the svg() helper. This test ensures the 'style' attribute is rendered correctly in the output SVG. ```PHP /** @test */ public function it_can_add_styles_to_icons() { $result = svg('tabler-accessible', ['style' => 'color: #555'])->toHtml(); $expected = <<<'SVG' SVG; $this->assertStringMatchesFormat($expected, $result); } ``` -------------------------------- ### Laravel Package Discovery Configuration Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/architecture.md This JSON snippet from composer.json configures Laravel's package discovery. It lists the service provider that Laravel should automatically register. ```json "extra": { "laravel": { "providers": [ "secondnetwork\\TablerIcons\\BladeTablerIconsServiceProvider" ] } } ``` -------------------------------- ### Usage of svg() in PHP Code Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/public-api.md Demonstrates obtaining an SVG object with classes and then converting it to an HTML string for output in PHP code. ```php $svg = svg('tabler-alert-circle', 'w-6 h-6 text-red-500'); $html = $svg->toHtml(); echo $html; ``` -------------------------------- ### Composer Autoloading Configuration Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/architecture.md This JSON snippet from composer.json defines the PSR-4 autoloading rules for the package. It maps the \"secondnetwork\TablerIcons\" namespace to the \"src\" directory. ```json "autoload": { "psr-4": { "secondnetwork\\TablerIcons\\": "src" } } ``` -------------------------------- ### Search for Specific Icon Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/installation-guide.md Searches for files containing 'alert' in their name within the resources/svg/ directory. ```bash ls resources/svg/ | grep alert ``` -------------------------------- ### Configure Default CSS Classes Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/configuration.md Apply default CSS classes to all icons globally. These classes are automatically added to the SVG element of every icon component rendered. ```php 'class' => 'inline-block align-middle', ``` -------------------------------- ### Enable Icon Caching for Production Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/icons-list.md Configure the Blade Icons package to cache compiled icon components. This improves performance by compiling icons only on their first use in production. ```php // config/blade-icons.php 'cache' => true, ``` -------------------------------- ### Test Naming Convention: test_ Prefix Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/test-details.md Demonstrates an alternative PHPUnit test naming convention where test methods are prefixed with 'test_'. ```PHP public function test_classes() ``` -------------------------------- ### Blade Components Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/public-api.md Icons are exposed as self-closing Blade components. The naming convention is ``, where `{icon-name}` is the kebab-case name of the icon file. Filled variants can be accessed using a `-f` or `-filled` suffix. These components accept standard Blade component attributes like `class` and any HTML attributes. ```APIDOC ## Blade Components All icons are available as self-closing Blade components. ### Component Naming Pattern ``` ``` **Format**: - **Prefix**: `tabler` (configured in `blade-tabler-icons.php`) - **Icon Name**: Kebab-case icon file name (without `.svg` extension) - **Variants**: `-f` or `-filled` suffix for filled versions ### Examples of Available Components | Icon File | |---| | `alert-circle.svg` | | `accessible.svg` | | `arrow-up.svg` | | `bell.svg` | | `check.svg` | | `alert-circle-f.svg` | | `alert-circle-filled.svg` | **Total Components**: 7,200+ (outline and filled variants) **Component Type**: Anonymous Blade component (provided by Blade Icons) ### Component Parameters All icon components accept standard Blade component attributes: #### Attributes (positional) | Parameter | |---| | `class` (string) - CSS classes to apply to the SVG element | | Attributes array (array) - HTML attributes to apply to the SVG element | #### Usage Examples ```blade ``` ``` -------------------------------- ### Filled Icon Component (Short Suffix) Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/icons-list.md An alternative for filled icons using a shorter '-f' suffix in the component name. ```html ``` -------------------------------- ### Using Icons in PHP Code Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/public-api.md Icons can be rendered directly within PHP code using the global svg() function. No import is required. ```php svg('tabler-alert-circle'); ``` -------------------------------- ### Composer Update Command Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/installation-guide.md Updates the blade-tabler-icons package to the latest version using Composer. ```bash composer update secondnetwork/blade-tabler-icons ``` -------------------------------- ### Default Configuration Reference Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/configuration.md View the default configuration settings for Blade Tabler Icons. This file, located at `config/blade-tabler-icons.php`, outlines all available options. ```php 'tabler', 'fallback' => 'section', 'class' => '', 'attributes' => [ // 'width' => 50, // 'height' => 50, ], ]; ``` -------------------------------- ### Test Naming Convention: Descriptive Names Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/test-details.md Highlights the importance of using descriptive names for test methods to clearly indicate the behavior being tested. ```PHP // Good public function it_applies_multiple_classes_to_icons() // Bad public function test_classes() ``` -------------------------------- ### Clear Caches Command Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/installation-guide.md Command to clear application caches including config and view caches. ```bash php artisan cache:clear && php artisan config:clear && php artisan view:clear ``` -------------------------------- ### Composer JSON Service Provider Declaration Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/installation-guide.md This JSON snippet shows how the service provider is declared in the composer.json file for automatic registration with Laravel. ```json { "extra": { "laravel": { "providers": [ "secondnetwork\TablerIcons\BladeTablerIconsServiceProvider" ] } } } ``` -------------------------------- ### Chaining Methods with svg() Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/public-api.md Methods like toHtml() can be chained directly after calling the svg() function for concise code. ```php svg('tabler-alert-circle') ->toHtml(); ``` -------------------------------- ### Register Service Providers Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/test-details.md This method registers the necessary service providers for the Blade Icons and Blade Tabler Icons packages within the test environment. ```php protected function getPackageProviders($app) { return [ BladeIconsServiceProvider::class, BladeTablerIconsServiceProvider::class, ]; } ``` -------------------------------- ### Using a Tabler Icon Component in Blade Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/architecture.md Demonstrates how to render a Tabler icon component directly within a Blade template. This is the primary method for displaying icons. ```blade ``` -------------------------------- ### Basic @svg() Directive Usage Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/icon-components.md Render an icon using the @svg() directive with the icon identifier. This is an alternative to Blade components. ```blade @svg('tabler-alert-circle') ``` -------------------------------- ### Modify Package Configuration Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/architecture.md Update the package's configuration values, such as CSS classes, directly within your application's service providers. This is useful for applying custom styling. ```php // In a service provider boot method config(['blade-tabler-icons.class' => 'custom-class']); ``` -------------------------------- ### Render Common UI Icons Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/icons-list.md Display a variety of common icons for UI elements like alerts, checks, navigation, and actions using their respective Blade component tags. ```blade ``` -------------------------------- ### Filled Icon Component (Full Suffix) Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/icons-list.md Utilize the filled variant for emphasis or active states. This uses the full '-filled' suffix in the component name. ```html ``` -------------------------------- ### Use Icon as Blade Component Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/README.md Render an icon using its Blade component syntax. You can apply Tailwind CSS classes for styling. ```blade ``` -------------------------------- ### Apply CSS Classes to Icon Component Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/test-details.md Tests the ability to add custom CSS classes to an icon component during rendering. It ensures that the provided classes are correctly applied to the SVG element. ```php /** @test */ public function it_can_add_classes_to_icons() { $result = svg('tabler-accessible', 'w-6 h-6 text-gray-500')->toHtml(); $expected = <<<'SVG' SVG; $this->assertStringMatchesFormat($expected, $result); } ``` -------------------------------- ### Blade Component with Combined Attributes Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/public-api.md Utilize both CSS classes and a dynamic attributes array for comprehensive styling and accessibility configuration of an icon component. ```blade ``` -------------------------------- ### Enable Icon Caching Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/icon-components.md To improve performance in production, enable icon caching by setting 'cache' to true in your `config/blade-icons.php` file. This compiles and caches icon components on first use. ```php 'cache' => true, ``` -------------------------------- ### Style Icons with Tailwind CSS and Inline Styles Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/icons-list.md Customize icon appearance by applying Tailwind CSS classes for size and color, or use inline styles to control properties like stroke width. ```blade ``` -------------------------------- ### Blade Component Naming Pattern Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/public-api.md The standard naming convention for Blade components representing icons. The prefix is configurable, and icon names are kebab-cased. Suffixes like -f or -filled indicate filled variants. ```blade ``` -------------------------------- ### svg() Function with CSS Classes Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/public-api.md Add CSS classes to an icon by passing them as the second argument to the svg() function. This allows for styling the icon's size and color. ```php echo svg('tabler-alert-circle', 'w-6 h-6 text-red-500'); ``` -------------------------------- ### Enabling Caching with Blade Icons Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/configuration.md Configure additional options supported by the underlying Blade Icons package, such as enabling caching. This can improve performance by caching rendered SVG icons. ```php 'attributes' => [ // ... tabler icons options ], // Pass through to Blade Icons 'cache' => true, ``` -------------------------------- ### Method Chaining for SVG Components Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/public-api.md SVG components support method chaining, allowing you to convert the component to an HTML string using the toHtml() method. ```php svg('tabler-alert-circle') ->toHtml(); // Returns HTML string ``` -------------------------------- ### Test Naming Convention: @test Annotation Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/test-details.md Illustrates the use of the @test annotation above a public method to mark it as a test case in PHPUnit. ```PHP /** @test */ public function it_should_do_something() ``` -------------------------------- ### Configure Default HTML Attributes Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/configuration.md Set default HTML attributes for all icons globally. These attributes are automatically applied to every rendered SVG element unless overridden. ```php 'attributes' => [ 'width' => 24, 'height' => 24, 'stroke-width' => 1.5, ], ``` -------------------------------- ### Accessibility Attributes for Icons Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/icon-components.md When using icons semantically, add accessibility attributes like `title` for tooltips and `aria-label` for screen readers. Ensure sufficient color contrast using text classes. ```blade ``` -------------------------------- ### Test Isolation Principle Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/test-details.md Explains that each test runs in an isolated Laravel application instance with its own service container and configuration state. ```PHP // Each test focuses on one behavior public function it_renders_icons() { ... } public function it_applies_classes() { ... } public function it_applies_styles() { ... } ``` -------------------------------- ### Blade Icons Factory Registration Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/public-api.md The package registers icons with the Blade Icons factory, making them available for use. The 'path' is set to the resources/svg directory. ```php $factory->add('tabler', [ 'path' => __DIR__.'/../resources/svg', // ... plus merged configuration options ]); ``` -------------------------------- ### Use Raw SVG Icon in View Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/README.md Reference published raw SVG icons using the asset helper function within your Blade views. ```blade ``` -------------------------------- ### Blade Component with Attributes Array Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/icon-components.md Pass attributes like style, aria-label, or data-* as an array to the component for comprehensive control. ```blade ``` -------------------------------- ### Use Filled Tabler Icons Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/README.md Render filled versions of icons using specific naming conventions for the component or directive. ```blade ``` ```blade ``` -------------------------------- ### @svg() Directive with CSS Classes Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/api-reference/icon-components.md Apply CSS classes to an icon rendered via the @svg() directive. The classes are passed as the second argument. ```blade @svg('tabler-alert-circle', 'w-6 h-6 text-gray-500') ``` -------------------------------- ### @svg() Directive with Attributes Source: https://github.com/secondnetwork/blade-tabler-icons/blob/main/_autodocs/installation-guide.md Renders an icon using the @svg() directive, applying CSS classes and custom HTML attributes. ```blade @svg('tabler-alert-circle', 'w-6 h-6', ['aria-label' => 'Alert']) ```