PHPackages                             8fold/php-markup - 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. 8fold/php-markup

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

8fold/php-markup
================

8fold Markup seeks to make writing semi-structured data easier while allowing for more dynamism.

0.9.5(4y ago)34211[2 issues](https://github.com/8fold/php-markup/issues)[1 PRs](https://github.com/8fold/php-markup/pulls)MITPHPPHP ^7.2|^8.0

Since Apr 19Pushed 4y ago1 watchersCompare

[ Source](https://github.com/8fold/php-markup)[ Packagist](https://packagist.org/packages/8fold/php-markup)[ GitHub Sponsors](https://github.com/8fold)[ GitHub Sponsors](https://github.com/joshbruce)[ RSS](/packages/8fold-php-markup/feed)WikiDiscussions main Synced 4d ago

READMEChangelog (10)Dependencies (4)Versions (55)Used By (0)

8fold Markup for PHP
====================

[](#8fold-markup-for-php)

8fold Markup is NOT a new markup format akin to XML, HTML, YAML, and all the other MLs; instead, it is a library for generating most of those (XML and HTML) using PHP.

It uses a similar API found in [8fold Shoop](https://github.com/8fold/php-shoop) to create consistency across libraries.

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

[](#installation)

```
composer require 8fold/php-markup

```

Usage
-----

[](#usage)

```
$element = Element::fold("hello");

print $lement->unfold();

// output:
```

You can also go straight to outputting a string.

```
$element = Element::fold("hello");

print $element;

// output:
```

You can add attributes to the elements.

```
$element = Element::fold("hello")->attr("id my-element");

print $element;

// output:
```

You can start with HTML, which is self-aware (understands and conforms to the w3c HTML specificaton).

If the HTML element is unknown, Markup will fall back to using Element.

```
$html = Html::p();

print $html->unfold();

print $html;
```

There are two ways to create more compound elements (or components at this point). The first example uses `Html` while the second used `UIKit`.

If the `UIKit` component is unknown, it will fallback to `Html`.

```
$html = Html::ul(
  Html::li("Hello, "),
  Html::li("World!")
);

print $html;

// output:
// Hello, World!

$uikit = UIKit::listWith(
  "Hello, ",
  "World!"
);

print($uikit);

// output: same as above
```

Why?
----

[](#why)

When it comes to semi-sctructured data, XML and derivitives can be tedious and heavy on syntax. 8fold Markup makes outputing semf-sctructured data easier and allowing for more dynamism.

Markup minifies the output, making a smaller, faster package sent over the wire.

Markup prefers one I/O step to compile (unfold) the resulting plain text, which means there is no parsing of strings to arrive at the desired output.

When it comes to HTML, attributes will be consistently ordered and, if a given attribute is not a part of the W3C HTML5 specification or is deprecated for that element, it will automatically be removed; keeping your markup up to date without having to rewrite a bunch of HTML templates.

Guiding Principles
------------------

[](#guiding-principles)

Minimize I/O while maximizing flexibility and extensibility.

Standardize HTML output and allow users to set their own standards.

Simplify creation of complex but typical complex elements (UIKit).

Governance
----------

[](#governance)

- Higher the number, higher the priority (labels on issues).
- Benevolant Dictatorship for now.

Contibuting
-----------

[](#contibuting)

Anyone can submit PRs to add funcationality as we are only adding things we need for the solutions we are developing.

Each PR will be reviewed, including those submitted by core developers (no direct push).

Versioning
----------

[](#versioning)

We follow [semantic versioning](https://semver.org/). We are operating under a [zero-major](https://semver.org/#spec-item-4) at this time. `x.y.z`: `x` = major, `y` = minor, `z` = patch. In this case `x` remains at 0 to communicate that APIs may come and go without warning. With that said, changes to `y` are typically reserved for breaking changes and changes to `z` represent added features and APIs or bug fixes.

History
-------

[](#history)

This library started as three (or more) separate libraries, each at varying degrees of stability.

`Element` was at 3.0.1; `Html` was also at 3.0.1; `UIKit` was never previously released to the public.

This library replaces those three; deprecating them in the process. (The sunsetting period for the other libraries and projects will end on or after January 1st 2021.)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance7

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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 ~10 days

Total

53

Last Release

1697d ago

PHP version history (5 changes)0.0.1PHP &gt;=7.0

0.1.21PHP ~7.0

0.5.2PHP ~7.0|^8.0

0.9.0PHP ~7.2|^8.0

0.9.2PHP ^7.2|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/3ff7aa36dc04c5b535cd71eadbf66038401edde0c9dfaa688bec4fc16c6d7e8b?d=identicon)[eightfold](/maintainers/eightfold)

---

Top Contributors

[![joshbruce](https://avatars.githubusercontent.com/u/15252830?v=4)](https://github.com/joshbruce "joshbruce (185 commits)")

---

Tags

htmlhtml-generatorhtml5php-markupphp7w3c-specificationweb-componentsxml

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/8fold-php-markup/health.svg)

```
[![Health](https://phpackages.com/badges/8fold-php-markup/health.svg)](https://phpackages.com/packages/8fold-php-markup)
```

###  Alternatives

[spatie/laravel-sitemap

Create and generate sitemaps with ease

2.6k14.6M107](/packages/spatie-laravel-sitemap)[sauladam/shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.

9738.8k](/packages/sauladam-shipment-tracker)[professional-wiki/edtf

PHP library to parse, represent and work with dates that follow the Extended Date/Time Format specification.

10432.1k4](/packages/professional-wiki-edtf)

PHPackages © 2026

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