Yii2 string helpers
, (*1)
Extension for Yii2 string helpers, (*2)
Installation
The preferred way to install this extension is through composer., (*3)
Either run, (*4)
composer require hyperia/yii2-string-helpers:"^1.0"
or add, (*5)
"hyperia/yii2-string-helpers": "^1.0"
to the require section of your composer.json., (*6)
Available Methods
- contains
- isLonger
- isShorter
- length
- toLower
- toUpper
- firstCharToUpper
- removeAccent
Usage
use hyperia\helpers\StringHelper;
echo StringHelper::isLonger('This is test string', 12); // 1
echo StrinhHelper::removeAccent('Ħí ŧħə®ë, юßť å test!'); // Hi there, jusst a test!
echo StringHelper::contains('is', 'This is test string'); // 1
Tests
./vendor/bin/phpunit