PHPackages                             paulredmond/html-to-amp - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. paulredmond/html-to-amp

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

paulredmond/html-to-amp
=======================

A PHP Library to Convert HTML to AMP HTML

v0.1.1(8y ago)6826.0k8MITPHP

Since May 30Pushed 8y ago7 watchersCompare

[ Source](https://github.com/paulredmond/html-to-amp)[ Packagist](https://packagist.org/packages/paulredmond/html-to-amp)[ RSS](/packages/paulredmond-html-to-amp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

HTML to AMP HTML
================

[](#html-to-amp-html)

A PHP Library to Convert HTML to [AMP HTML](https://www.ampproject.org/)

**This is a new library and not considered stable yet.**

### Documentation

[](#documentation)

See the [wiki](https://github.com/paulredmond/html-to-amp/wiki). Documentation is a WIP right now.

### Why?

[](#why)

I have a need to convert HTML content into valid AMP (a subset of HTML) format from disparate CMS systems in a (hopefully) somewhat consistent manner. Instead of hacking regular expressions and doing the same thing over and over again, I thought it would be useful to create a library to parse HTML and convert it into AMP HTML.

The library's **main purpose is parsing fragments of HTML content (an article body)** and converting it into valid AMP. At this point you could try to parse an entire HTML document, but that's not this library's sweet spot. Pull requests are welcomed of course if you find a need; [open an issue](https://github.com/paulredmond/html-to-amp/issues) and discuss your ideas before submitting a PR so I can understand your goals/needs and align them to this project.

### Design Goals

[](#design-goals)

- Make it simple, yet extensible
- Convert and Replace Elements in a passive way
- Allow client code to configure which conversions run
- Allow client code to add custom conversions as needed

### Inspiration

[](#inspiration)

This Library was inspired by code design patterns found in the wonderful [thephpleague/html-to-markdown](https://github.com/thephpleague/html-to-markdown) PHP library. Generally, the objectives in this Library are similiar: parse HTML into another format—in this case a subset of HTML.

### Testing

[](#testing)

[![Build Status](https://camo.githubusercontent.com/322c35ea9bbd236f240234bd6d069f5bb0404cbdb0d3b10a0490181feb864737/68747470733a2f2f7472617669732d63692e6f72672f7061756c7265646d6f6e642f68746d6c2d746f2d616d702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/paulredmond/html-to-amp)

```
$ vendor/bin/phpspec run

```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.2% 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 ~495 days

Total

2

Last Release

3137d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f1f2bdc174e6b3abd3e7e57df84f8a5d6756290b945db8755022dfdb3b98a293?d=identicon)[paulredmond](/maintainers/paulredmond)

---

Top Contributors

[![paulredmond](https://avatars.githubusercontent.com/u/177773?v=4)](https://github.com/paulredmond "paulredmond (52 commits)")[![mgonzo](https://avatars.githubusercontent.com/u/1801416?v=4)](https://github.com/mgonzo "mgonzo (4 commits)")[![elhardoum](https://avatars.githubusercontent.com/u/7893147?v=4)](https://github.com/elhardoum "elhardoum (1 commits)")

---

Tags

htmlampamp-html

### Embed Badge

![Health badge](/badges/paulredmond-html-to-amp/health.svg)

```
[![Health](https://phpackages.com/badges/paulredmond-html-to-amp/health.svg)](https://phpackages.com/packages/paulredmond-html-to-amp)
```

###  Alternatives

[spatie/laravel-html

A fluent html builder

8376.4M72](/packages/spatie-laravel-html)[magyarandras/amp-converter

A library to convert HTML articles, blog posts or similar content to AMP (Accelerated Mobile Pages).

65150.3k](/packages/magyarandras-amp-converter)[ckeditor/ckeditor

JavaScript WYSIWYG web text editor.

5234.2M76](/packages/ckeditor-ckeditor)[caxy/php-htmldiff

A library for comparing two HTML files/snippets and highlighting the differences using simple HTML.

21520.9M15](/packages/caxy-php-htmldiff)[yajra/laravel-datatables-html

Laravel DataTables HTML builder plugin

2899.6M48](/packages/yajra-laravel-datatables-html)[wa72/htmlpagedom

jQuery-inspired DOM manipulation extension for Symfony's Crawler

3383.9M34](/packages/wa72-htmlpagedom)

PHPackages © 2026

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