troccoli/blade-health-icons

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

v4.0.0 2024-10-22 13:59 UTC

README

Social Card Blade Health Icons

Blade Health Icons

Tests StyleCI Packagist Version Packagist Downloads

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

For a full list of available icons see the SVG directory or preview them at healthicons.org.

Requirements

  • PHP 8.1 or higher
  • Laravel 10.0 or higher

Installation

composer require troccoli/blade-health-icons

The people at Healthicons.org have now moved to published the icon as an NPM package following SemVer. This means that I can now tie the releases of this package to that one.

Versions of Blade Health Icon prior to 3.0.0 were based on a date, i.e. from time to time, or when I knew new icons were available, I would update this package and make a new release.

From now on however, I will follow Healthicons.org versioning, albeit with a slight difference because I had already started using SemVer.

For this reason, if you want a particular version of the Healthicons.org package then you need to look at the following table and use the correct version for this package.

Blade Icons

Blade Healthicons uses Blade Icons under the hood. Please refer to the Blade Icons readme for additional functionality. We also recommend to enable icon caching with this library.

Configuration

Blade Healthicons also offers the ability to use features from Blade Icons like default classes, default attributes, etc. If you'd like to configure these, publish the blade-health-icons.php config file:

php artisan vendor:publish --tag=blade-health-icons-config

Usage

Health Icons provides two types of icons: filled and outlined.

Once you have found the icon you want to use on their site, click on it and make a note of the filename. The name of the icon to use will be the filename, where you replace the underscore with dashes. For example, the Blood A- icon's filename is blood_a_n, so the name for the icon will be blood-a-n.

Icons can be used as self-closing Blade components which will be compiled to SVG icons:

<x-healthicons-o-blood-a-n/>

You can also pass classes to your icon components:

<x-healthicons-o-blood-a-n class="w-6 h-6 text-gray-500"/>

And even use inline styles:

<x-healthicons-o-blood-a-n style="color: #555"/>

The filled icons can be referenced like this:

<x-healthicons-f-blood-a-n/>

Raw SVG Icons

If you want to use the raw SVG icons as assets, you can publish them using:

php artisan vendor:publish --tag=blade-health-icons --force

Then use them in your views like:

<img src="{{ asset('vendor/blade-health-icons/o-blood-a-n.svg') }}" width="10" height="10"/>

Changelog

Check out the CHANGELOG in this repository for all the recent changes.

Maintainers

Blade Healthicons is developed and maintained by Giulio Troccoli-Allard.

License

Blade Healthicons is open-sourced software licensed under the MIT license.