becklyn / search-text-transformer
一个库,用于从HTML中提取纯文本,以便在搜索引擎(如Elasticsearch)中使用
2.0.0
2022-12-12 10:40 UTC
Requires
- php: >=8.1
Requires (Dev)
- phpunit/phpunit: ^9.5.7
- symfony/filesystem: ^2.8 | ^3.0
- symfony/finder: ^2.8 | ^3.0
- symfony/phpunit-bridge: ^3.4|^4.0
This package is auto-updated.
Last update: 2024-09-12 14:09:38 UTC
README
将HTML转换为可搜索的纯文本,以便与搜索引擎(如Elasticsearch)一起使用。
安装
通过composer安装。
用法
<?php use Becklyn\SearchText\SearchTextTransformer; $transformer = new SearchTextTransformer(); $plain = $transformer->transform("<p>Some HTML content</p>");
测试
所有测试用例应放入 tests/fixtures
中,且文件扩展名必须为 .test
。
测试格式为
--TEST--
Here is a plain text description of this test.
--HTML--
<p>Some html.</p>
--EXPECT--
The expected result.
--TEST--
段落是可选的。