{"id":16489485,"url":"https://github.com/j0k3r/php-readability","last_synced_at":"2025-10-20T01:48:11.704Z","repository":{"id":24508169,"uuid":"27913843","full_name":"j0k3r/php-readability","owner":"j0k3r","description":"A fork of https://bitbucket.org/fivefilters/php-readability","archived":false,"fork":false,"pushed_at":"2024-10-11T06:56:35.000Z","size":244,"stargazers_count":168,"open_issues_count":8,"forks_count":36,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-10-12T13:44:14.590Z","etag":null,"topics":["content","extract-website","hacktoberfest","php","php-library","readability","text-rss","tidy"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/j0k3r.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"j0k3r"}},"created_at":"2014-12-12T09:27:16.000Z","updated_at":"2024-10-11T06:56:40.000Z","dependencies_parsed_at":"2024-03-18T09:29:59.183Z","dependency_job_id":"1b403dd2-477d-42ce-8509-b35f5604aff9","html_url":"https://github.com/j0k3r/php-readability","commit_stats":{"total_commits":95,"total_committers":8,"mean_commits":11.875,"dds":0.3052631578947368,"last_synced_commit":"7cd8476d3888fb4cc322769704e6447b8f0e3835"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j0k3r%2Fphp-readability","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j0k3r%2Fphp-readability/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j0k3r%2Fphp-readability/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j0k3r%2Fphp-readability/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/j0k3r","download_url":"https://codeload.github.com/j0k3r/php-readability/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248890273,"owners_count":21178389,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["content","extract-website","hacktoberfest","php","php-library","readability","text-rss","tidy"],"created_at":"2024-10-11T13:44:16.913Z","updated_at":"2025-10-20T01:48:06.656Z","avatar_url":"https://github.com/j0k3r.png","language":"PHP","readme":"# Readability\n\n![CI](https://github.com/j0k3r/php-readability/workflows/CI/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/j0k3r/php-readability/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/j0k3r/php-readability/?branch=master)\n[![Total Downloads](https://poser.pugx.org/j0k3r/php-readability/downloads)](https://packagist.org/packages/j0k3r/php-readability)\n[![License](https://poser.pugx.org/j0k3r/php-readability/license)](https://packagist.org/packages/j0k3r/php-readability)\n\nThis 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).\n\n## Differences\n\nThe 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.\n\n - I've extracted the class from its fork to be able to use it out of the box\n - I've added some simple tests\n - and changed the CS, run `php-cs-fixer` and added a namespace\n\n**But** the code is still really hard to understand / read ...\n\n## Requirements\n\nBy default, this lib will use the [Tidy extension](https://github.com/htacg/tidy-html5) if it's available. Tidy is only used to cleanup the given HTML and avoid problems with bad HTML structure, etc .. It'll be suggested by Composer.\n\nAlso, if you got problem from parsing a content without Tidy installed, please install it and try again.\n\n## Usage\n\n```php\nuse Readability\\Readability;\n\n$url = 'http://www.medialens.org/index.php/alerts/alert-archive/alerts-2013/729-thatcher.html';\n\n// you can use whatever you want to retrieve the html content (Guzzle, Buzz, cURL ...)\n$html = file_get_contents($url);\n\n$readability = new Readability($html, $url);\n// or without Tidy\n// $readability = new Readability($html, $url, 'libxml', false);\n$result = $readability-\u003einit();\n\nif ($result) {\n    // display the title of the page\n    echo $readability-\u003egetTitle()-\u003etextContent;\n    // display the *readability* content\n    echo $readability-\u003egetContent()-\u003etextContent;\n} else {\n    echo 'Looks like we couldn\\'t find the content. :(';\n}\n```\n\nIf 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):\n\n```php\nuse Readability\\Readability;\nuse Monolog\\Logger;\nuse Monolog\\Handler\\StreamHandler;\n\n$url = 'http://www.medialens.org/index.php/alerts/alert-archive/alerts-2013/729-thatcher.html';\n$html = file_get_contents($url);\n\n$logger = new Logger('readability');\n$logger-\u003epushHandler(new StreamHandler('path/to/your.log', Logger::DEBUG));\n\n$readability = new Readability($html, $url);\n$readability-\u003esetLogger($logger);\n```\n","funding_links":["https://github.com/sponsors/j0k3r"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj0k3r%2Fphp-readability","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fj0k3r%2Fphp-readability","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj0k3r%2Fphp-readability/lists"}