承接 friedolinfoerder/html-changer 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

friedolinfoerder/html-changer

最新稳定版本:v0.1.6

Composer 安装命令:

composer require friedolinfoerder/html-changer

包简介

Parse html and change it's output

README 文档

README

With this tiny library you can parse html code and change it's output. Other than many other similar modules, this library do not change the existing code while parsing. So you can only change the parts you need to change, while leaving all other code as is.

Installation

composer require friedolinfoerder/html-changer

Usage

use html_changer\HtmlChanger

// parse html
$htmlChanger = new HtmlChanger($html);

// search and replace text
$htmlChanger = new HtmlChanger($text, [
    'search' => [
        'test' => [
            'value' => 'TEST', 
            'caseInsensitive' => false, // default false
            'wordBoundary' => true, // default true
            'group' => 1, // default is the key (here 'test') 
            'maxCount' => 3, // default -1, means no rescriction
        ]
    ],
    'ignore' => [
        'b',
        'h1',
        'h2',
        'a',
        '.ignored',
        '#ad',
    ]
]);
$htmlChanger->replace(function ($text, $value) {
    return $text . '/' . $value;
});

// print html code
print $htmlChanger->html();

统计信息

  • 总下载量: 6.53k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-03-01