2017 © Pedro Peláez
 

yii2-extension yii2-helpers

Collection of handy helpers for Yii2 websites

image

nirvana-msu/yii2-helpers

Collection of handy helpers for Yii2 websites

  • Wednesday, August 24, 2016
  • by nirvana-msu
  • Repository
  • 1 Watchers
  • 1 Stars
  • 55 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

yii2-helpers

Collection of handy helpers for Yii2 websites., (*1)

Installation

Composer

Add extension to your composer.json and update your dependencies as usual, e.g. by running composer update, (*2)

{
    "require": {
        "nirvana-msu/yii2-helpers": "1.0.*@dev"
    }
}

HtmlHelper

Inject arbitrary code into existing HTML structure, before or after a chosen opening/closing tag, e.g.:, (*3)

$html = HtmlHelper::inject($htmlToInject, $originalHtml, 'head', HTMLHelper::TAG_OPENING, HTMLHelper::POS_AFTER);

Convert HTML to plain text:, (*4)

$text = HtmlHelper::htmlToPlainText($html);

MathHelper

Create a histogram with specified bins out of a given array: * $values array, e.g. [11, 12, 20, 25, 20.1, 33.5] * $edges array, e.g. [0, 10, 20, 30, 40] * returns array histogram, e.g. ['0-10' => [], '10-20' => [11,12], '20-30' => [20,25,20.1], '30-40' => [33.5]], (*5)

$histogram = MathHelper::histogram($values, $edges);

RbacHelper

Create role with a given name and description and add it to RBAC system:, (*6)

$role = RbacHelper::createRole($name, $description)

Create permission with a given name and description and add it to RBAC system, assigning permission to the role:, (*7)

$permission = RbacHelper::createChildPermission($role, $name, $description);

Remove rule from RBAC system by name:, (*8)

RbacHelper::removeRuleByName($rule->name);

Remove permission from RBAC system by name:, (*9)

RbacHelper::removePermissionByName($name)

Remove role from RBAC system by name:, (*10)

RbacHelper::removeRoleByName($name)

License

Extension is released under MIT license., (*11)

The Versions

24/08 2016

dev-master

9999999-dev

Collection of handy helpers for Yii2 websites

  Sources   Download

MIT

The Requires

 

by Alexander Stepanov

yii2