Skip to content

aegiswp/icons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Aegis Icons

An SVG icon management library for the Aegis Framework.

Installation

composer require aegis/icons

Usage

This library provides a simple way to manage and render SVG icons in your WordPress theme or plugin.

Retrieving an Icon

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;

Registering a Custom Icon Set

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' );

REST API

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

Contributing

Contributions are welcome! Please submit a pull request or create an issue on the GitHub repository.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages