PHPackages                             tacman/php-readability - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. tacman/php-readability

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

tacman/php-readability
======================

Automatic article extraction from HTML, fork of j0k3r/php-readability

2.1.0(1w ago)05811Apache-2.0PHPPHP ^8.2

Since Dec 12Pushed 1w agoCompare

[ Source](https://github.com/tacman/php-readability)[ Packagist](https://packagist.org/packages/tacman/php-readability)[ GitHub Sponsors](https://github.com/j0k3r)[ RSS](/packages/tacman-php-readability/feed)WikiDiscussions tac Synced 1w ago

READMEChangelog (4)Dependencies (18)Versions (51)Used By (1)

Readability
===========

[](#readability)

[![CI](https://github.com/j0k3r/php-readability/workflows/CI/badge.svg)](https://github.com/j0k3r/php-readability/workflows/CI/badge.svg)[![Coverage Status](https://camo.githubusercontent.com/c92d010c7997dbe711a107d4100ec05a02e9e31ca48dd8850dfc7ec907f7cc53/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6a306b33722f7068702d726561646162696c6974792f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/j0k3r/php-readability/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/6233cf1a62b478cca6ebe79cd700aaa531eced0973b6712e87f13c99d9984eb4/68747470733a2f2f706f7365722e707567782e6f72672f6a306b33722f7068702d726561646162696c6974792f646f776e6c6f616473)](https://packagist.org/packages/j0k3r/php-readability)[![License](https://camo.githubusercontent.com/7407e48deac60fba0b4765edf26eb8e1217e5bc57699ae77b81f74db96130e2d/68747470733a2f2f706f7365722e707567782e6f72672f6a306b33722f7068702d726561646162696c6974792f6c6963656e7365)](https://packagist.org/packages/j0k3r/php-readability)

This is an extract of the Readability class from this [full-text-rss](https://github.com/Dither/full-text-rss) fork. It can be defined as a better version of the original [php-readability](https://bitbucket.org/fivefilters/php-readability).

Differences
-----------

[](#differences)

The default php-readability lib is really old and needs to be improved. I found a great fork of full-text-rss from [@Dither](https://github.com/Dither/full-text-rss) which improve the Readability class.

- I've extracted the class from its fork to be able to use it out of the box
- I've added some simple tests
- and changed the CS, run `php-cs-fixer` and added a namespace

**But** the code is still really hard to understand / read ...

This fork (tacman/php-readability)
----------------------------------

[](#this-fork-tacmanphp-readability)

This is [tacman](https://github.com/tacman)'s fork, kept current for PHP 8.5 / Symfony 8 consumers. The `tac` branch is periodically merged forward from `upstream/master`(`j0k3r/php-readability`) to stay close to upstream. [`tacman/graby`](https://github.com/tacman/graby)(also a `tac`-branch fork) depends on this package by name, so pulling in that graby fork brings this one in transitively — you don't need to require it directly unless you use `Readability`standalone.

To use it directly in a consuming app, point `composer.json` at the `tac` branch — no `repositories` block needed, Composer resolves it straight from Packagist:

```
composer require tacman/php-readability:dev-tac
```

Tagged releases (e.g. `2.1.0`) are also published and satisfy a plain `"*"` constraint if you'd rather float to the latest stable tag instead of tracking the branch.

Requirements
------------

[](#requirements)

By default, this lib will use the [Tidy extension](https://github.com/htacg/tidy-html5) if it's available (checked via PHP's `function_exists('tidy_parse_string')`, no hard `ext-tidy` requirement). Tidy is only used to cleanup the given HTML and avoid problems with bad HTML structure, etc .. It'll be suggested by Composer, not required — the lib works fine without it installed, just with lower extraction quality on badly-formed HTML.

Also, if you got problem from parsing a content without Tidy installed, please install it and try again.

Usage
-----

[](#usage)

> **Note**Call `->init()` exactly once, explicitly, after constructing a `Readability` instance — the constructor does not call it for you. Calling it twice re-runs extraction against an already-consumed DOM and silently produces empty results on the second pass.

```
use Readability\Readability;

$url = 'http://www.medialens.org/index.php/alerts/alert-archive/alerts-2013/729-thatcher.html';

// you can use whatever you want to retrieve the html content (Guzzle, Buzz, cURL ...)
$html = file_get_contents($url);

$readability = new Readability($html, $url);
// or without Tidy
// $readability = new Readability($html, $url, 'libxml', false);
$result = $readability->init();

if ($result) {
    // display the title of the page
    echo $readability->getTitle()->textContent;
    // display the *readability* content
    echo $readability->getContent()->textContent;
} else {
    echo 'Looks like we couldn\'t find the content. :(';
}
```

If you want to debug it, or check what's going on, you can inject a logger (which must follow `Psr\Log\LoggerInterface`, Monolog for example):

```
use Readability\Readability;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;

$url = 'http://www.medialens.org/index.php/alerts/alert-archive/alerts-2013/729-thatcher.html';
$html = file_get_contents($url);

$logger = new Logger('readability');
$logger->pushHandler(new StreamHandler('path/to/your.log', Logger::DEBUG));

$readability = new Readability($html, $url);
$readability->setLogger($logger);
```

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance98

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity89

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 63.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~88 days

Recently: every ~78 days

Total

49

Last Release

11d ago

Major Versions

1.2.10 → 2.0.42024-10-11

1.2.11 → 2.0.62025-03-04

1.2.12 → 2.0.72025-06-03

1.3.0 → 2.0.82026-03-27

1.3.1 → 2.0.92026-07-11

PHP version history (6 changes)v1.0PHP &gt;=5.4

v1.0.2PHP &gt;=5.3.3

1.2.0PHP &gt;=5.6.0

2.0.4PHP &gt;=7.4.0

2.0PHP ^8.2

1.3.0PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/21b39551f92ed4143772c622f9e571589c5a72c96ab3c53fe67489ce0d83e806?d=identicon)[tacman1123](/maintainers/tacman1123)

---

Top Contributors

[![j0k3r](https://avatars.githubusercontent.com/u/62333?v=4)](https://github.com/j0k3r "j0k3r (152 commits)")[![jtojnar](https://avatars.githubusercontent.com/u/705123?v=4)](https://github.com/jtojnar "jtojnar (41 commits)")[![Kdecherf](https://avatars.githubusercontent.com/u/226063?v=4)](https://github.com/Kdecherf "Kdecherf (18 commits)")[![tacman](https://avatars.githubusercontent.com/u/619585?v=4)](https://github.com/tacman "tacman (12 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (10 commits)")[![Simounet](https://avatars.githubusercontent.com/u/582666?v=4)](https://github.com/Simounet "Simounet (3 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")[![nicofrand](https://avatars.githubusercontent.com/u/3419050?v=4)](https://github.com/nicofrand "nicofrand (1 commits)")

---

Tags

htmlcontentextractionarticlearticle extractioncontent extraction

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tacman-php-readability/health.svg)

```
[![Health](https://phpackages.com/badges/tacman-php-readability/health.svg)](https://phpackages.com/packages/tacman-php-readability)
```

###  Alternatives

[j0k3r/php-readability

Automatic article extraction from HTML

184929.4k11](/packages/j0k3r-php-readability)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19467.3M1.9k](/packages/drupal-core)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6943.5M449](/packages/drupal-core-recommended)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k39.6k](/packages/matomo-matomo)[wikimedia/parsoid

Parsoid, a bidirectional parser between wikitext and HTML5

200569.1k3](/packages/wikimedia-parsoid)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
