zhalker/dumb-artifact-for-multi-level-contextual-parsing-in-php
最新稳定版本:v1.2.0
Composer 安装命令:
composer require zhalker/dumb-artifact-for-multi-level-contextual-parsing-in-php
包简介
An unnecessarily complex tool that replaces patterns through multi-level contextual parsing in PHP. Dumb, yet somehow useful
README 文档
README
An unnecessarily complex tool that performs multi-level contextual text replacements in PHP. Useful for transforming text inside nested or scoped contexts while skipping comments and handling escapes.
Installation
Require the package with Composer (replace your-vendor/your-repo with the repository name you publish on GitHub/Packagist):
composer require zhalker/dumb-artifact-for-multi-level-contextual-parsing-in-php
Note: locally the package is autoloaded via the
vendor/autoload.phpgenerated by Composer.
Namespace and autoloading
This library uses PSR-4 autoloading. The base namespace is DumbContextualParser\ and maps to the src/ directory.
Example class: DumbContextualParser\ContextualReplaceText
Basic usage example
<?php require __DIR__ . '/vendor/autoload.php'; use DumbContextualParser\ContextualReplaceText; $text = "<html>\n<!-- ignore this comment -->\n<body>"; $rules = [ [ 'scope_start' => '<body>', 'scope_end' => '</body>', 'self_replace' => [ 'open' => '"', 'close' => '"', 'pattern' => '<em>%s</em>' ], 'inner_scopes' => [] ] ]; $result = ContextualReplaceText::applyContexts($text, $rules); echo $result;
Notes
- The repository package name (
zhalker/dumb-artifact-for-multi-level-contextual-parsing-in-php) can stay as-is for GitHub/Packagist; the PHP namespace used in code isDumbContextualParser\. - Consider adding tests (PHPUnit) and an
examples/directory with runnable examples.
License
MIT
统计信息
- 总下载量: 19
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-16