PHPackages                             kartik-v/yii2-icons - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kartik-v/yii2-icons

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

kartik-v/yii2-icons
===================

Set of icon frameworks for use in Yii Framework 2.0

v1.4.8(4y ago)731.0M↓32%28[5 issues](https://github.com/kartik-v/yii2-icons/issues)20BSD-3-ClauseCSS

Since Oct 5Pushed 2y ago6 watchersCompare

[ Source](https://github.com/kartik-v/yii2-icons)[ Packagist](https://packagist.org/packages/kartik-v/yii2-icons)[ Docs](https://github.com/kartik-v/yii2-icons)[ RSS](/packages/kartik-v-yii2-icons/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (3)Versions (14)Used By (20)

 [ ![Krajee Logo](https://camo.githubusercontent.com/4addfbb3869c3fc7d79befea4f06d9cf3655a686fb503df0da1d725859cfdef9/687474703a2f2f6b617274696b2d762e6769746875622e696f2f626f6f7473747261702d66696c65696e7075742d73616d706c65732f73616d706c65732f6b72616a65652d6c6f676f2d622e706e67) ](http://demos.krajee.com "Krajee Demos")
 yii2-icons ---

 [![Donate](https://camo.githubusercontent.com/0336bc43d88554a3f2d6c74dddf312bc2c65c2eacca70d83ae40f5567098d00e/68747470733a2f2f6b617274696b2d762e6769746875622e696f2f626f6f7473747261702d66696c65696e7075742d73616d706c65732f73616d706c65732f646f6e6174652e706e67)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DTP3NZQ6G2AYU "Donate via Paypal") [![kartikv](https://camo.githubusercontent.com/0cf29a542375e1a46e84d8bf5805a4e5c0a6ee98b6547ccdc0c55eed49d99c69/68747470733a2f2f63646e2e6275796d6561636f666665652e636f6d2f627574746f6e732f76322f64656661756c742d79656c6c6f772e706e67)](https://www.buymeacoffee.com/kartikv "Buy me a coffee")
=============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#------------------------yii2-icons------------------)

[![Latest Stable Version](https://camo.githubusercontent.com/2b4a8684732b52fd50b19b474430035b0f147239d661f9437c4c095f4bfcea1b/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d69636f6e732f762f737461626c65)](https://packagist.org/packages/kartik-v/yii2-icons)[![Latest Unstable Version](https://camo.githubusercontent.com/4cf32f72358f42e707a361d6a374f2a5ac3b8660c4105529e710d8476211ebff/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d69636f6e732f762f756e737461626c65)](https://packagist.org/packages/kartik-v/yii2-icons)[![License](https://camo.githubusercontent.com/3023602754ae6aba05abeb49e939249cb745e0fad3db6fb8a89e2f5df0b7aa93/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d69636f6e732f6c6963656e7365)](https://packagist.org/packages/kartik-v/yii2-icons)[![Total Downloads](https://camo.githubusercontent.com/ab46b5fd25e2b9102c18387c5452acabb02f45ded70c467bb5c3e4723133a5c0/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d69636f6e732f646f776e6c6f616473)](https://packagist.org/packages/kartik-v/yii2-icons)[![Monthly Downloads](https://camo.githubusercontent.com/1eff0a70e3b38a12b3457c966b81fc77ca166ff712165a3c999a34bea87a4f60/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d69636f6e732f642f6d6f6e74686c79)](https://packagist.org/packages/kartik-v/yii2-icons)[![Daily Downloads](https://camo.githubusercontent.com/52e1af39d74ff429a8eadb81454e4165999201ce02a1eea0f32ce2a55abd1ff8/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d69636f6e732f642f6461696c79)](https://packagist.org/packages/kartik-v/yii2-icons)

This extension offers an easy method to setup various icon frameworks to work with Yii Framework 2.0. Most popular and free icon frameworks available are currently supported. This list may be extended in future based on demand and feedback.

1. [Bootstrap Glyphicons](http://getbootstrap.com/components/#glyphicons)
2. [Font Awesome](https://fontawesome.com/icons)
3. [Unicode Icons](http://demos.krajee.com/uni-icons/): A collection of unicode symbols made available as CSS icons by Krajee
4. [Elusive Icons](http://elusiveicons.com/icons/)
5. [Typicons](http://typicons.com/)
6. [Web Hosting Hub Glyphs](http://www.webhostinghub.com/glyphs/)
7. [JQuery UI Icons](http://api.jqueryui.com/theming/icons/)
8. [Socicon Icons](http://www.socicon.com/): Needs you to add attribution to the icon source.
9. [Octicons](https://octicons.github.com/): The Github icons collection.
10. [Flag-Icons](https://lipis.github.io/flag-icons/)
11. [Open Iconic Icons](https://useiconic.com/open#icons)
12. [IcoFont Icons](http://icofont.com/)

### Demo

[](#demo)

You can see a [demonstration here](http://demos.krajee.com/icons) and [API Code Documentation](https://docs.krajee.com/kartik-icons-icon) on usage of this extension with documentation and examples.

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

> Note: Check the [composer.json](https://github.com/kartik-v/yii2-icons/blob/master/composer.json) for this extension's requirements and dependencies. Read this [web tip /wiki](http://webtips.krajee.com/setting-composer-minimum-stability-application/) on setting the `minimum-stability` settings for your application's composer.json.

Either run

```
$ php composer.phar require kartik-v/yii2-icons "@dev"

```

or add

```
"kartik-v/yii2-icons": "@dev"

```

to the `require` section of your `composer.json` file.

Usage
-----

[](#usage)

### Global Setup

[](#global-setup)

In case you wish to setup one Icon framework globally, set the parameter `icon-framework` in the `params` array of your Yii Configuration File.

```
'params' => [
  'icon-framework' => \kartik\icons\Icon::FAS,  // Font Awesome Icon framework
]
```

To initialize the globally setup framework in your view, call this code in your view or view layout file.

```
use kartik\icons\Icon;
Icon::map($this);
```

### Per View Setup

[](#per-view-setup)

You can also call each icon-framework individually in your view or view layout like below. Map any icon framework within each view as in the example below.

```
use kartik\icons\Icon;
Icon::map($this, Icon::EL); // Maps the Elusive icon font framework
```

### Displaying Icons

[](#displaying-icons)

After mapping your icon framework with one of the options above, you can display icons using `Icon::show` method. Icons can be displayed using one of the options below:

```
use kartik\icons\Icon;

// Option 1: Uses the `icon-framework` setup in Yii config params.
echo Icon::show('user');

// Option 2: Specific Icon Call in a view. Additional options can also be passed to style the icon.
echo Icon::show('user', ['class'=>'fa-2x', 'framework' => Icon::FAS]);
```

> NOTE: The `kartik\icons\Icon::show` method outputs a HTML formatted text. So in order to display icons in Yii-2 components like Navbar or Nav, you must set `encodeLabels` to false.

```
$items = [
    ['label' => Icon::show('home') . 'Home', 'url' => ['/site/index']],
];

// Your other code

/* Note you must encodeLabels to false to display icons in labels */
echo \kartik\nav\NavX::widget([
    'items' => $items,
    'encodeLabels' => false
]);

// Your other code
```

### Displaying Stacked Icons

[](#displaying-stacked-icons)

You can also display stacked icons for frameworks like Font Awesome, where this is supported. For example:

```
use kartik\icons\Icon;
// fa-twitter on fa-square
 Icon::showStack('twitter', 'square', ['class'=>'fa-lg'], ['framework' => Icon::FAB], ['framework' => Icon::FAR])

// fa-flag on fa-circle
 Icon::showStack('flag', 'circle', ['class'=>'fa-lg'], ['class'=>'fa-inverse']);
```

### Add Custom Icons

[](#add-custom-icons)

You can add custom icon sets to the list of available frameworks.

```
use kartik\icons\Icon;
// add framework
Icon::addFramework('custom', [
    'class' => '\common\icons\CustomIconAsset',
    'prefix' => 'custom-icon',
]);

// map to view file
Icon::map($this, 'custom');

// show the icon
echo Icon::show('menu',['framework' => 'custom']);
```

```
namespace common\icons;
class CustomIconAsset extends \yii\web\AssetBundle
{
    public $sourcePath = '@common/icons/assets/custom';
    public $depends = array(
        'yii\web\YiiAsset',
        'yii\bootstrap4\BootstrapAsset'
    );
    public $css=[
        'css/animation.css',
        'css/custom-codes.css',
        'css/custom-embedded.css',
        'css/custom-ie7.css',
        'css/custom-ie7-codes.css',
        'css/custom.css',
    ];
}
```

The above asset bundle uses files genereted by .

License
-------

[](#license)

**yii2-icons** is released under the BSD-3-Clause License. See the bundled `LICENSE.md` for details.

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity54

Moderate usage in the ecosystem

Community34

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 90.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~225 days

Recently: every ~364 days

Total

13

Last Release

1584d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3592619?v=4)[Kartik Visweswaran](/maintainers/kartik-v)[@kartik-v](https://github.com/kartik-v)

---

Top Contributors

[![kartik-v](https://avatars.githubusercontent.com/u/3592619?v=4)](https://github.com/kartik-v "kartik-v (117 commits)")[![derekisbusy](https://avatars.githubusercontent.com/u/5118781?v=4)](https://github.com/derekisbusy "derekisbusy (4 commits)")[![EvilKarter](https://avatars.githubusercontent.com/u/3779278?v=4)](https://github.com/EvilKarter "EvilKarter (2 commits)")[![davidsonalencar](https://avatars.githubusercontent.com/u/3989763?v=4)](https://github.com/davidsonalencar "davidsonalencar (2 commits)")[![ScottHuangZL](https://avatars.githubusercontent.com/u/8861324?v=4)](https://github.com/ScottHuangZL "ScottHuangZL (1 commits)")[![bupy7](https://avatars.githubusercontent.com/u/5145037?v=4)](https://github.com/bupy7 "bupy7 (1 commits)")[![peelman](https://avatars.githubusercontent.com/u/52936?v=4)](https://github.com/peelman "peelman (1 commits)")[![angoliar](https://avatars.githubusercontent.com/u/13576215?v=4)](https://github.com/angoliar "angoliar (1 commits)")

---

Tags

yii2extensionyiiiconfont

### Embed Badge

![Health badge](/badges/kartik-v-yii2-icons/health.svg)

```
[![Health](https://phpackages.com/badges/kartik-v-yii2-icons/health.svg)](https://phpackages.com/packages/kartik-v-yii2-icons)
```

###  Alternatives

[kartik-v/yii2-helpers

A collection of useful helper functions for Yii Framework 2.0

933.1M29](/packages/kartik-v-yii2-helpers)[kartik-v/yii2-datecontrol

Date control module allowing separation of formats for View and Model for Yii Framework 2.0

551.6M39](/packages/kartik-v-yii2-datecontrol)[sjaakp/yii2-taggable

Manage tags of ActiveRecord in Yii2.

2932.6k](/packages/sjaakp-yii2-taggable)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
