jeyroik/preg

此软件包最新版本(1.3.1)没有提供许可证信息。

简单的preg替换包装器

安装: 432

依赖项: 1

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

公开问题: 0

类型:项目

1.3.1 2019-02-19 11:14 UTC

This package is auto-updated.

Last update: 2024-09-29 05:01:38 UTC


README

简单的preg替换包装器。

已弃用。已迁移到 jeyroik/extas-foundation 作为 Replace

安装

composer require jeyroik/preg:1.0

用法

use jeyroik\tools\components\Preg;

$s = 'Hello, @user.name! You hit this page @user.stat.hits times!';
$preg = new Preg();
echo $preg->apply([
  'user' => [
    'name' => 'JeyRoik',
    'stat' => [
      'hits' => 10
    ]
  ]
])->to($s);

结果将是

Hello, JeyRoik! You hit this page 10 times!