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

1.0.3 2019-09-23 09:12 UTC

This package is auto-updated.

Last update: 2024-10-23 20:21:28 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]
        ],
    ]
}