kartik-v/yii2-helpers A collection of useful helper functions for Yii Framework 2.0


Krajee Logo
yii2-helpers Donate

Latest Stable Version Latest Unstable Version License Total Downloads Monthly Downloads Daily Downloads

This extension is a collection of useful helper functions for Yii Framework 2.0.

Html Class


This class extends the Yii Html Helper to incorporate additional HTML markup functionality and features available in Bootstrap 3.x / 4.x. The helper functions available in this class are:

  • Icon
  • Label
  • Badge
  • Page Header
  • Well
  • Close Button
  • Caret
  • Jumbotron
  • Abbreviation
  • Blockquote
  • Address
  • List Group
  • Panel
  • Media
  • Media List
  • Checkbox Button Group
  • Radio Button Group

Enum Class


This class extends the Yii Inflector Helper with more utility functions for Yii developers. The helper functions available in this class are:

  • Is Empty
  • In Array
  • Properize
  • Time Elapsed
  • Time To String
  • Time Remaining
  • Format Bytes
  • Number to Words
  • Year List
  • Month List
  • Day List
  • Date List
  • Time List
  • Boolean List
  • Get PHP Data Type
  • Array to HTML Table
  • IP Address


You can see a demonstration here on usage of these functions with documentation and examples.


The preferred way to install this extension is through composer.

Note: Check the composer.json for this extension's requirements and dependencies. Read this web tip /wiki on setting the minimum-stability settings for your application's composer.json.

Either run

$ php composer.phar require kartik-v/yii2-helpers "dev-master"

or add

"kartik-v/yii2-helpers": "dev-master"

to the require section of your composer.json file.


// add this to your code to use these classes
use kartik\helpers\Html;
use kartik\helpers\Enum;

// examples of usage
echo Html::icon('cloud');
echo Enum::properize('Chris');


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


Change Log: yii2-helpers

Version 1.3.9

Date: 09-Oct-2018

  • Remove composer yii2 bootstrap dependency and correct yii2-krajee-base dependency.
  • Enhance Html::media and Html::mediaList for Bootstrap 4.x.

Version 1.3.8

Date: 27-Sep-2018

  • Bump up version.

Version 1.3.7

Date: 26-Sep-2018

  • Enhancements to support Bootstrap v4.x.
  • Move all source code to src directory.
  • (enh #44): Secure userIP function.
  • (enh #43): Update Vietnamese Translations.
  • (enh #42): Update Hungarian Translations.
  • (enh #41): Update German Translations.
  • (enh #40): Fixed a moment ago readout.
  • (enh #39): Update Greek Translations.

Version 1.3.6

Date: 26-Nov-2016

  • (bug #38): Fix buttonGroup item parsing when set as Closure.
  • (enh #37): Update Finnish Translations.
  • (enh #36): Update Russian Translations.
  • (enh #35): Add Slovak Translations.
  • (enh #33): Update Italian Translations.
  • Update message config to include all default standard translation files.
  • Add github contribution and issue/PR logging templates.
  • Add branch alias for dev-master latest release.
  • Update PHP documentation for all classes in the extension.

Version 1.3.4

Date: 12-Dec-2015

  • (enh #29): Code style and formatting enhancements.
  • (enh #28): Add Italian Translations.
  • (enh #27): Add Ukranian Translations.

Version 1.3.3

Date: 22-Oct-2015

  • (enh #25): Fix russian traslation for "a moment ago"
  • (enh #26): Add functionality for Bootstrap Checkbox Button Group and Radio Button Group. New additions:
    • checkboxButtonGroup
    • radioButtonGroup
    • activeCheckboxButtonGroup
    • activeRadioButtonGroup

Version 1.3.2

Date: 09-Sep-2015

  • (enh #24): New timeInterval method in addition to timeElapsed.

Version 1.3.1

Date: 15-Jun-2015

  • (enh #22): Add Spanish translations.
  • (bug #21): Remove duplicate browsers in list.
  • (enh #19): Add Portuguese Brazilian translation messages.
  • (enh #17, #18): Update Russian translation messages.
  • (enh #16): Add Russian translation messages.
  • (enh #15): Initialize i18N for getBrowser method.

Version 1.3.0

Date: 23-Jan-2015

  • (enh #12): Completed French Translations.
  • (enh #11): Add French Translations and fix genCalList.
  • (enh #10): Enhance timeList method to include ranges and intervals.
  • (enh #9): Add/Enhance new methods for dayList, monthList and dateList.
  • (enh #8): Convert days, months, ones, tens, triplets to static methods
  • (enh #7): Implement translations.

Version 1.2.0

Date: 10-Nov-2014

  • Set release to stable

Version 1.1.0

Date: 12-Aug-2014

  • added inArray helper method - much faster than the inbuilt PHP in_array method
  • updated documentation for newer methods
  • PSR4 alias change

Version 1.0.0

Date: 01-Mar-2014

Initial release


GitHub Stars
GitHub Forks



v1.3.9 is the latest of 13 releases

BSD-3-Clause license
83 github stars & 45 github forks
974 downloads in the last day
21842 downloads in the last 30 days
518741 total downloads