Tinkerwell - The PHP Scratchpad

Blade Icons

blade-ui-kit/blade-icons image

Blade Icons stats

Downloads
5.4M
Stars
1,888
Open Issues
1
Forks
128

View on GitHub →

A package to easily make use of icons in your Laravel Blade views.

Blade Icons

Blade Icons is a versatile Laravel package designed to simplify the integration and management of SVG icons within Laravel Blade views. It is a refined evolution of "Blade SVG" originally developed by Adam Wathan.

Key Features

  • Ease of Use: Convert verbose SVG HTML markup into clean Blade component tags or directives.
  • Extensive Icon Support: Compatible with a broad range of third-party icon sets, thanks to community contributions.
  • Caching: Includes a caching mechanism to enhance performance when dealing with large icon sets.
  • Flexible Configuration: Supports custom icon sets, default classes, attributes, prefixes, and multi-path icons.
  • Component and Directive Options: Use Blade components or directives based on preference.
  • Fallback Icons: Specify fallback icons to ensure graceful handling of missing icons.

Installation

  1. Install via composer:
    composer require blade-ui-kit/blade-icons
  2. Publish the configuration file:
    php artisan vendor:publish --tag=blade-icons
    Ensure to uncomment and verify the default icon set path in the published config, typically pointing to resources/svg.

Usage

Blade Icons can be used in various ways including:

  • Blade Components, simplifying syntax to:
    <x-icon-camera class="w-6 h-6"/>
  • Directives, allowing for:
    @svg('camera', 'w-6 h-6')
  • Helper Functions, for a fluent syntax:
    {{ svg('camera')->class('w-6 h-6') }}

Configuration

To customize icon sets, classes, attributes, or prefixes, modify the blade-icons.php in your config directory. You can define multiple icon sets with custom paths or even use external storage disks like AWS S3.

Caching

To cache icons for production, use:

php artisan icons:cache

This optimizes performance by creating a manifest of all icon sets and their paths.

Building Custom Icon Packages

For those interested in extending functionality with custom icons, Blade Icons offers a straightforward approach to create and register new icon packages, utilizing a template repository for ease of setup.

Requirements

  • PHP 7.4 or higher
  • Laravel 8.0 or higher

Maintainers

Developed and maintained by Dries Vints, with the package open for contributions from the community.

License

Blade Icons is released under the MIT license, ensuring it is free to use and modify.

This package not only simplifies the management and deployment of icons across Laravel applications but also encourages best practices with its flexible and developer-friendly API.

blade-ui-kit photo

A set of open-source libraries built for Laravel Blade.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Blade Ui Kit Blade Icons Related Articles

Laravel Blade Country and Language Icons image

Laravel Blade Country and Language Icons

Read article
Laravel Blade Icons Stable Release image

Laravel Blade Icons Stable Release

Read article
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell