Download the PHP package tacman/php-readability without Composer
On this page you can find all versions of the php package tacman/php-readability. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tacman/php-readability
More information about tacman/php-readability
Files in tacman/php-readability
Package php-readability
Short Description Automatic article extraction from HTML, fork of j0k3r/php-readability
License Apache-2.0
Informations about the package php-readability
Readability
This is an extract of the Readability class from this full-text-rss fork. It can be defined as a better version of the original php-readability.
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 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-fixerand added a namespace
But the code is still really hard to understand / read ...
This fork (tacman/php-readability)
This is 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
(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:
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
By default, this lib will use the Tidy extension 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
Note Call
->init()exactly once, explicitly, after constructing aReadabilityinstance — 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.
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):
All versions of php-readability with dependencies
ext-mbstring Version *
psr/log Version ^3.0
masterminds/html5 Version ^2.7