{"id":23428863,"url":"https://github.com/bicpi/htmlconverter","last_synced_at":"2025-09-20T08:59:30.462Z","repository":{"id":8012317,"uuid":"9420773","full_name":"bicpi/HtmlConverter","owner":"bicpi","description":"PHP5 library that provides easy HTML-to-Text conversion","archived":false,"fork":false,"pushed_at":"2020-07-28T07:48:30.000Z","size":40,"stargazers_count":11,"open_issues_count":1,"forks_count":13,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-13T10:18:07.023Z","etag":null,"topics":["htmlconverter","php","php-library"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bicpi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-04-13T22:01:34.000Z","updated_at":"2018-09-27T19:38:10.000Z","dependencies_parsed_at":"2022-09-09T14:01:28.697Z","dependency_job_id":null,"html_url":"https://github.com/bicpi/HtmlConverter","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/bicpi/HtmlConverter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bicpi%2FHtmlConverter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bicpi%2FHtmlConverter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bicpi%2FHtmlConverter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bicpi%2FHtmlConverter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bicpi","download_url":"https://codeload.github.com/bicpi/HtmlConverter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bicpi%2FHtmlConverter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276070743,"owners_count":25580129,"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","status":"online","status_checked_at":"2025-09-20T02:00:10.207Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["htmlconverter","php","php-library"],"created_at":"2024-12-23T07:14:51.844Z","updated_at":"2025-09-20T08:59:30.444Z","avatar_url":"https://github.com/bicpi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bicpi's HtmlConverter library\n\nHtmlConverter is a PHP library that provides easy HTML-to-Text conversion. This is useful, for example, for\nautomatically creating plain text parts of HTML emails.\n\n[![Build Status](https://travis-ci.org/bicpi/HtmlConverter.svg?branch=master)](https://travis-ci.org/bicpi/HtmlConverter)\n\n## Usage\n\n1. Create converter\n2. Call `-\u003econvert($html)` method\n3. Enjoy returned plain text\n\n### SimpleConverter\n\nThe `SimpleConverter` works on every PHP enabled system by using PHP's `strip_tags()` function and putting some HTML\nentity decoding on top.\n\n```php\n\u003c?php\n\nuse bicpi\\HtmlConverter\\Converter\\SimpleConverter;\n\n$html = '... \u003ch1\u003e... you HTML content ...\u003c/h1\u003e ...';\n$converter = new SimpleConverter();\n$plain = $converter-\u003econvert($html);\n```\n\n### LynxConverter\n\nThe `LynxConverter` works on every system with the `lynx` text browser package installed. The converted plain text\nis equivalent to what you would see when opening the HTML in `lynx`. This is currently the most useful converter as\nit provides the best results and includes all links as references.\n\n```php\n\u003c?php\n\nuse bicpi\\HtmlConverter\\Converter\\LynxConverter;\n\n$html = '... \u003ch1\u003e... you HTML content ...\u003c/h1\u003e ...';\n$converter = new LynxConverter();\n$plain = $converter-\u003econvert($html);\n```\n\n### Html2TextConverter\n\nThe `Html2TextConverter` works on every system with the `html2text` package installed. The converted plain text\nis equivalent to what you would see when passing the HTML on the command line to the `html2text` command. The result\nis quite nice but be aware that links will be removed. Hence, this should not be used for converting a whole web page\nor marketing email. May be useful for small chunks of HTML code.\n\n```php\n\u003c?php\n\nuse bicpi\\HtmlConverter\\Converter\\Html2TextConverter;\n\n$html = '... \u003ch1\u003e... you HTML content ...\u003c/h1\u003e ...';\n$converter = new Html2TextConverter();\n$plain = $converter-\u003econvert($html);\n```\n\n### ChainConverter\n\nThe `ChainConverter` offers converter chaining so that the first appropriate converter will handle the conversion.\n\n```php\n\u003c?php\n\nuse bicpi\\HtmlConverter\\Converter\\ChainConverter;\nuse bicpi\\HtmlConverter\\Converter\\LynxConverter;\nuse bicpi\\HtmlConverter\\Converter\\SimpleConverter;\n\n$html = '... \u003ch1\u003e... you HTML content ...\u003c/h1\u003e ...';\n$converter = new ChainConverter();\n$converter-\u003eaddConverter(new LynxConverter());\n$converter-\u003eaddConverter(new SimpleConverter());\n$plain = $converter-\u003econvert($html);\n```\nIn the above example the conversion will be handled by the `LynxConverter` - provided that the `lynx` package is\navailable. If not, the `SimpleConverter` will be used as a fallback. This for instance would be useful when deploying\nto a machine without `lynx` installed but a development machine without the package - e.g. Windows.\n\n## Running unit tests\n\nTo setup and run tests follow these steps:\n\n1. Go to the root directory of this library\n2. Run: `composer install`\n3. Run: `./vendor/bin/phpunit`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbicpi%2Fhtmlconverter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbicpi%2Fhtmlconverter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbicpi%2Fhtmlconverter/lists"}