Outsource Laravel Development Partner - $3200/Month | Bacancy

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
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
Lucky Media logo

Lucky Media

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

Lucky Media
Tinkerwell logo

Tinkerwell

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

Tinkerwell
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
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
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $3200/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy