PHPackages                             roelofjan-elsinga/content-to-html-parser - 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. roelofjan-elsinga/content-to-html-parser

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

roelofjan-elsinga/content-to-html-parser
========================================

This package converts content from strings or files to HTML strings to be rendered on a page

0.5.1(6y ago)07.4k—9.3%[1 PRs](https://github.com/roelofjan-elsinga/content-to-html-parser/pulls)2MITPHPPHP &gt;=7.2.0CI failing

Since Jun 12Pushed 5mo agoCompare

[ Source](https://github.com/roelofjan-elsinga/content-to-html-parser)[ Packagist](https://packagist.org/packages/roelofjan-elsinga/content-to-html-parser)[ RSS](/packages/roelofjan-elsinga-content-to-html-parser/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (4)Dependencies (2)Versions (8)Used By (2)

Content to HTML Parser
======================

[](#content-to-html-parser)

[![Build status](https://camo.githubusercontent.com/e59a19c9aa4b52253f3e412c8bb4b2c35fbb0b2d0bc20ded13914c07bbc632e4/68747470733a2f2f7472617669732d63692e636f6d2f726f656c6f666a616e2d656c73696e67612f636f6e74656e742d746f2d68746d6c2d7061727365722e737667)](https://travis-ci.com/roelofjan-elsinga/content-to-html-parser)[![StyleCI Status](https://camo.githubusercontent.com/768a8871ffbf0d4b5193ff579e05ea39dd4c3d82a83714f132151f5692b73d91/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3139313532353236382f736869656c64)](https://github.styleci.io/repos/191525268)[![Code coverage](https://camo.githubusercontent.com/7a35cafc26bcce941612fd09d9bab4198fb70f9c96753219e39210377f4040fd/68747470733a2f2f636f6465636f762e696f2f67682f726f656c6f666a616e2d656c73696e67612f636f6e74656e742d746f2d68746d6c2d7061727365722f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/roelofjan-elsinga/content-to-html-parser)[![Total Downloads](https://camo.githubusercontent.com/a040c278775d8cc932f988b2b090b4352f3faf786836bc95cbc4bda284cd7ad7/68747470733a2f2f706f7365722e707567782e6f72672f726f656c6f666a616e2d656c73696e67612f636f6e74656e742d746f2d68746d6c2d7061727365722f646f776e6c6f616473)](https://packagist.org/packages/roelofjan-elsinga/content-to-html-parser)[![Latest Stable Version](https://camo.githubusercontent.com/cbcc214c8e414ed57da485f976e992aceec42937029c05ea6ef8cc98d05ac52a/68747470733a2f2f706f7365722e707567782e6f72672f726f656c6f666a616e2d656c73696e67612f636f6e74656e742d746f2d68746d6c2d7061727365722f762f737461626c65)](https://packagist.org/packages/roelofjan-elsinga/content-to-html-parser)[![License](https://camo.githubusercontent.com/18aa445446e8037f29afda86ab6a3f165e8ac18c5e7577d61ce0cf8a1eeb4ea3/68747470733a2f2f706f7365722e707567782e6f72672f726f656c6f666a616e2d656c73696e67612f636f6e74656e742d746f2d68746d6c2d7061727365722f6c6963656e7365)](https://packagist.org/packages/roelofjan-elsinga/content-to-html-parser)

This package converts content from strings or files to HTML strings to be rendered on a page.

Installation
------------

[](#installation)

You can include this package through Composer using:

```
composer require roelofjan-elsinga/content-to-html-parser
```

Usage
-----

[](#usage)

```
use ContentParser\ContentParser;

$parser = ContentParser::forFile('/absolute/path/to/file.txt');

// OR

$parse_string = 'This is some beautiful text';

$parser = ContentParser::forString($parse_string, 'txt');

print $parser->parse(); // This is an HTML string
```

Available parsers
-----------------

[](#available-parsers)

There are currently three parsers included:

- **HTML to HTML**: This doesn't modify the string
- **Markdown to HTML**: This parses Markdown to HTML strings
- **TXT to HTML**: This parses plain text to usable HTML markup through nl2br()

Available methods
-----------------

[](#available-methods)

This package comes with two named constructors:

- `public static function forFile(string $file_path): ContentParserInterface`
- `public static function forString(string $file_contents, string $file_extension = null): ContentParserInterface`

You can parse the strings and get the resulting HTML string by calling: `public function parse(): string`

If you want to get the underlying parser, you can use: `public function getParser(): ContentParserInterface`

Testing
-------

[](#testing)

You can run the included tests by running `./vendor/bin/phpunit` in your terminal.

Contributions
-------------

[](#contributions)

If you want to contribute you can add additional ContentParsers or improve the current parsers.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance49

Moderate activity, may be stable

Popularity24

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~47 days

Total

6

Last Release

2341d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2602444740bac106e338fc57a5d16b085ba02a9ca3d714c2106dccccbf97bba2?d=identicon)[roelofjanelsinga](/maintainers/roelofjanelsinga)

---

Top Contributors

[![roelofjan-elsinga](https://avatars.githubusercontent.com/u/9220754?v=4)](https://github.com/roelofjan-elsinga "roelofjan-elsinga (15 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/roelofjan-elsinga-content-to-html-parser/health.svg)

```
[![Health](https://phpackages.com/badges/roelofjan-elsinga-content-to-html-parser/health.svg)](https://phpackages.com/packages/roelofjan-elsinga-content-to-html-parser)
```

###  Alternatives

[erusev/parsedown-extra

An extension of Parsedown that adds support for Markdown Extra.

84315.3M218](/packages/erusev-parsedown-extra)[kimai/kimai

Kimai - Time Tracking

4.8k9.0k1](/packages/kimai-kimai)[couscous/couscous

Documentation website generator

83970.1k24](/packages/couscous-couscous)[benjaminhoegh/parsedown-extended

An extension for Parsedown.

5126.7k1](/packages/benjaminhoegh-parsedown-extended)[benjaminhoegh/parsedown-toc

Table of Contents Extension for Parsedown.

2137.2k14](/packages/benjaminhoegh-parsedown-toc)[tovic/parsedown-extra-plugin

Configurable Markdown to HTML converter with Parsedown Extra.

5934.9k](/packages/tovic-parsedown-extra-plugin)

PHPackages © 2026

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