becklyn/search-text-transformer

A library that extracts plain text from HTML for usage in search engines (like Elasticsearch)

1.0.0 2016-12-30 00:51 UTC

This package is auto-updated.

Last update: 2021-09-06 22:33:44 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.