zualex/parsertext

This is a PHP class to parse the text using the template

1.0.0 2016-10-11 06:34 UTC

This package is not auto-updated.

Last update: 2024-04-13 16:56:51 UTC


README

This is a PHP class to parse the text using the template.

Installation

composer require zualex/parsertext

Exmaple

require_once __DIR__ . '/vendor/autoload.php';

use \ParserText\ParserText;

$parserSms = new ParserText('
    Никому не говорите пароль! Его спрашивают только мошенники.
    Пароль: {% password %}
    Перевод на счет {% receiver %}
    Вы потратите {% sum %}р.
');

print_r($parserSms->run('
    Никому не говорите пароль! Его спрашивают только мошенники.
    Пароль: 72946
    Перевод на счет 410011068150008
    Вы потратите 5025,13р.
'));

Result:

[
    'password' => '72946',
    'receiver' => '410011068150008',
    'sum' => '5025,13',
]