j0k3r/php-readability
Extracts the main article content and title from messy web pages in PHP. Improved fork of php-readability with tests, namespacing, and optional HTML cleanup via Tidy (or libxml). Supports PSR-3 logging for debugging.
DOMDocument/SimpleXML, with no external library changes.tidy_repair_string encoding fix (PR #112) resolves a critical bug where malformed UTF-8 or non-ASCII content could corrupt parsing. This reduces false negatives in extraction for non-English content or pages with special characters (e.g., Cyrillic, CJK).spatie/browsershot for JS-rendered pages).Log::debug('Extracted content encoding:', mb_detect_encoding($article['content']))) to catch residual issues.spatie/browsershot, spatie/laravel-medialibrary).html-entities or legacy systems).$content = $article['content'];
if (mb_detect_encoding($content, 'UTF-8', true) !== 'UTF-8') {
Log::warning('Non-UTF-8 content detected; repairing...');
$content = mb_convert_encoding($content, 'UTF-8');
}
encoding_corruption event).mbstring functions).htmlentities() with ENT_QUOTES | ENT_HTML5 to generate test cases.Log::debug('Input HTML encoding', [
'detected' => mb_detect_encoding($html),
'sample' => substr($html, 0, 100),
]);
| Failure Type | Impact | Mitigation |
|---|---|---|
| Encoding Corruption | Resolved: Fixed in 1.3.1. | Monitor logs for residual issues; update tests. |
| HTML Parsing Errors | Reduced risk for non-ASCII content. | Fallback to raw HTML if encoding issues persist. |
| Queue Backlog | Unchanged. | Scale workers as before. |
| Memory Exhaustion | Unchanged. | Optimize Readability settings. |
Key Takeaway: The 1.3.1 release resolves a critical encoding bug, improving reliability for multilingual or special-character content. Update tests and logging to validate the fix, but no architectural or integration changes are required. NO BREAKING CHANGES.
How can I help you explore Laravel packages today?