An SVG icon management library for the Aegis Framework.
composer require aegis/iconsThis library provides a simple way to manage and render SVG icons in your WordPress theme or plugin.
You can easily get an SVG icon by specifying the set and icon name.
use Aegis\Icons\Icon;
// Get the 'star' icon from the 'wordpress' set
$icon_html = Icon::get_svg( 'wordpress', 'star' );
// Get the icon with a specific size
$icon_html_with_size = Icon::get_svg( 'wordpress', 'star', 24 );
echo $icon_html;You can register your own custom icon sets from your theme or plugin.
use Aegis\Icons\Icon;
add_action( 'init', function() {
$my_icon_set_path = get_stylesheet_directory() . '/assets/my-icons';
Icon::register_icon_set( 'my-custom-set', $my_icon_set_path );
} );Once registered, you can retrieve icons from your custom set just like any other set:
$custom_icon = Icon::get_svg( 'my-custom-set', 'custom-icon-name' );This library also exposes a REST API endpoint to fetch icon data. By default, the endpoint is blockify/v1/icons.
- Get all icons:
GET /wp-json/blockify/v1/icons/ - Get a specific set:
GET /wp-json/blockify/v1/icons/?set=wordpress - Get all set names:
GET /wp-json/blockify/v1/icons/?sets=true
Contributions are welcome! Please submit a pull request or create an issue on the GitHub repository.