liderman/php-text-generator

基于模板的快速SEO文本生成器

v1.0.0 2018-06-20 22:09 UTC

This package is not auto-updated.

Last update: 2024-09-28 19:52:51 UTC


README

基于模板的快速SEO文本生成器。

用PHP编写。我不使用正则表达式,速度最快。我覆盖了测试,简单!支持递归文本生成规则。支持多种编码。

此包实现了类似Go语言的包的功能 - text-generator

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

安装

composer require liderman/php-text-generator

用法

简单模板文本生成的示例

$textGen = new TextGenerator();
echo $textGen->generate("Good {morning|day}!");
// Displays: Good morning!
// or
// Good day!

复杂模板文本生成的示例

$textGen = new TextGenerator();
echo $textGen->generate("{Good {morning|evening|day}|Goodnight|Hello}, {friend|brother}! {How are you|What's new with you}?");
// Displays: Good morning, friend! How are you?
// or
// Good day, brother! What's new with you?
// or
// Hello, friend! How are you?
// ...

特性

  • 支持多种编码
  • 支持递归文本生成规则
  • 快速!不使用正则表达式
  • 由于集成的界面,易于包装
  • 覆盖测试
  • 遵循PSR标准编写,100%带有文档(PHP-Doc)
  • 无外部依赖
  • 代码通过静态分析器PhpStan lvl 7进行检查

要求

  • PHP >= 7.1