dev-master
9999999-devCollection of handy helpers for Yii2 websites
MIT
The Requires
by Alexander Stepanov
yii2
Collection of handy helpers for Yii2 websites
Collection of handy helpers for Yii2 websites., (*1)
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" } }
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);
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);
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)
Extension is released under MIT license., (*11)
Collection of handy helpers for Yii2 websites
MIT
yii2