mrssoft / yii2-mdash
E. Muravjov's typographer for Yii2
Installs: 223
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: >=2.0.13
This package is auto-updated.
Last update: 2024-04-23 19:19:14 UTC
README
E. Muravjov's typographer for Yii2
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist mrssoft/yii2-mdash "*"
or add
"mrssoft/yii2-mdash": "*"
to the require section of your composer.json
file.
Usage
Configuration:
'components' => [
...
'mdash' => [
'class' => 'mrssoft\mdash\Mdash',
'remote' => true, // Use remote API or local. Default false.
'options' => [ // Typograph options. See http://mdash.ru/rules.html
'Text.paragraphs' => 'off',
'Text.breakline' => 'off',
'OptAlign.all' => 'off',
'Etc.unicode_convert' => 'off',
'Nobr.spaces_nobr_in_surname_abbr' => 'off',
'Etc.split_number_to_triads' => 'off'
]
]
....
]
Usage:
$mdash = new Mdash([
'remote' => false,
'options' => [
'Text.paragraphs' => 'off',
]
]);
echo $mdash->process("мой текст");
Usage as filter:
public function rules()
{
return [
['text',
'\mrssoft\mdash\MdashFilter',
'options' => ['remove' => false]
],
]
}