becklyn / search-text-transformer
A library that extracts plain text from HTML for usage in search engines (like Elasticsearch)
Installs: 930
Dependents: 1
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/becklyn/search-text-transformer
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: 2025-09-12 16:27:38 UTC
README
Transforms HTML to searchable plain text for usage in conjunction with a search engine (like Elasticsearch).
Installation
Install via composer.
Usage
<?php use Becklyn\SearchText\SearchTextTransformer; $transformer = new SearchTextTransformer(); $plain = $transformer->transform("<p>Some HTML content</p>");
Testing
All test cases belong into tests/fixtures
and must have the file extension .test
.
The test format is:
--TEST--
Here is a plain text description of this test.
--HTML--
<p>Some html.</p>
--EXPECT--
The expected result.
The --TEST--
segment is optional.