Download the PHP package abetwothree/laravel-iconify-api without Composer
On this page you can find all versions of the php package abetwothree/laravel-iconify-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download abetwothree/laravel-iconify-api
More information about abetwothree/laravel-iconify-api
Files in abetwothree/laravel-iconify-api
Package laravel-iconify-api
Short Description A package to create a local API for the dynamic Iconify Icon components
License MIT
Homepage https://github.com/abetwothree/laravel-iconify-api
Informations about the package laravel-iconify-api
Laravel Iconify API
Make your Laravel Application an API for on demand icons using the Iconify icon web components.
This Laravel package creates a few API routes for the Iconify icons on demand API. It allows you to easily use on demand icons and use your Laravel applicatioin as the Iconify API.
It works similarly to the Node Iconify API and is a spiritual successor to their PHP implementation.
On demand icons work great whether you use Livewire, Inertia, or just plain Blade views to render your Laravel application and want to render icons dynamically using a single component.
Requirements
- PHP 8.5, 8.4
- Laravel 13.x, 12.x or 11.x
How To Use
Install the package via composer:
In your core application blade layout file add the following directive in the head section before your application's JS bundle:
This will configure the Iconify API on demand icons to load the icons from your Laravel application instead of the Iconify API.
By default Icon API routes will work out of the following route path in your Laravel application:
The following routes are currently available:
/iconify/api/{prefix}.json?icons={icon-prefix}- Returns icon SVG data for an icon set. Icon prefix can be comma separated for multiple icons./iconify/api/{prefix}/icons.json?icons={icon-prefix}- Same as above./iconify/api/collections- Returns a list of icon collections available in your application./iconify/api/collection?prefix={prefix}- Returns the information for a specific icon collection.
How To Display Icons
To displays icons follow the instructions on the Iconify on demand docs and use any of their component libraries in your Laravel Application.
You also need icon set data to be available in your application. You'll need to install the icon set data using NPM. See more info here.
We recommend installing individual icon sets instead of the entire Iconify JSON set to keep your application lightweight. However, you can install the entire set if you wish and this package will work with either approach.
Advanced Configuration
To configure the package, you can publish the config file using the following command:
This will publish a iconify-api.php file in your config directory. You can then configure the package to your liking.
For advanced setting details, please see the config file.
If you update your configuration file, make sure to break your application cache with the following commands:
Icon Caching
This package uses Laravel's caching system to cache the icon data to make repeated requests for the same icon faster. It caches icon data when it is requested so that it only caches the icons that are actually used in your application.
You can set which cache store to use for this package in your config/iconify-api.php file. Otherwise, it will use your default cache store setting.
Missing Features
The MVP of this package was to provide an API for on demand icons in your Laravel Application. A few API endpoints that currently exist on the Node JS package that are missing in this package and will be added in future releases:
- [ ] Return icon data in in JSONP callback format.
- [ ] List icons in a collection.
- [ ] List icons categorized in a collection.
- [ ] Search endpoint for icons.
- [ ] Keywords endpoint for icons.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Code Quality
This package uses the following code quality tools:
- PHPStan 2.x at level 10 for static analysis.
- Laravel Pint for consistent code style.
- PHP Pest for testing.
Credits
- Abraham Arango
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-iconify-api with dependencies
ext-json Version *
illuminate/contracts Version ^13||^12||^11.0
spatie/laravel-package-tools Version ^1.16
pcrov/jsonreader Version ^1.0