PHPackages                             nethead/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. [Templating &amp; Views](/categories/templating)
4. /
5. nethead/markup

ActiveLibrary[Templating &amp; Views](/categories/templating)

nethead/markup
==============

Package for HTML markup generation in Laravel

v2.11(3y ago)0612MITPHPPHP ^7.3CI failing

Since Jul 6Pushed 3y ago1 watchersCompare

[ Source](https://github.com/kamil17289/markup)[ Packagist](https://packagist.org/packages/nethead/markup)[ RSS](/packages/nethead-markup/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (20)Used By (2)

Nethead \\ Markup
=================

[](#nethead--markup)

Markup is a package which let's you generate HTML code using objective PHP. It can be used as a helper in Blade templates (Laravel), but it basically is created as a support package for my other projects.

The package is framework-independent. This means you can install it in every project which is using PSR-4 autoloading.

Usage
-----

[](#usage)

Use Nethead\\Markup\\MarkupFactory to build object representation of the needed HTML. Use can generate menus, links, blocks, paragraphs, anything. MarkupFactory includes useful static helpers to quickly generate what you want. The package also includes a `tag` helper function if you like the functional approach more.

Generating HTML code
--------------------

[](#generating-html-code)

```
use Nethead\Markup\MarkupFactory as Html;
// or
use function Nethead\Markup\Helpers\tag;

// Link to Google.com
Html::anchor('https://google.com', ['Go to Google'])->blank();

// Image link
Html::anchor('https://google.com', [
    Html::image('/img/google.png', 'Google Logo')
])->blank();

// Paragraph
tag('p', ['class' => 'px-2'], [
    'Here is how you can search with',
    tag('a', ['href' => 'https://google.com'], ['Google'])->blank()
]);
```

Markup objects are designed to support methods chaining, with self-explanatory syntax, and ability to pass them through the chain of execution. It makes it easy to make changes to the markup with comfortable objective API, instead of operating on strings or arrays. This is useful for example when you have multiple modules, each altering or adding something to the HTML.

Using HtmlAttributes
--------------------

[](#using-htmlattributes)

Each Markup object has a public attrs() method which returns the HtmlAttributes object, which in turn allows you to set, remove or modify the attributes of an HTML element.

```
$menuItem = tag('li', ['class' => 'nav-item'], ['Discount!']);
// (...)
$menuItem->attrs()
    ->set('class', 'bold');
```

Using ClassList object
----------------------

[](#using-classlist-object)

Each Markup object is also allowing you to set and remove CSS classes without calling the attr() object. You can access the ClassList object directly with classList() public method:

```
if ($menuItem->classList()->caintains('bold')) {
    $menuItem->attrs()->data('modal', 'discount');
}
```

Configuring the package
-----------------------

[](#configuring-the-package)

Using the HtmlConfig you can easily change how the HTML is generated. For example, if you like to have void tags (like input) closed everytime, just call this before you start creating:

```
use Nethead\Markup\Helpers\HtmlConfig;

HtmlConfig::$closeVoids = true;
```

Refer to the documentation to have a better insight of what can be configured and how.

Icons Factory
-------------

[](#icons-factory)

The IconsFactory makes it easy to switch between the icon fonts providers. By default, it is configured to generate Font Awesome HTML tags. For example, if you're using the Bootstrap's Glyphicons, you could do:

```
use Nethead\Markup\Helpers\IconsFactory;
use Nethead\Markup\Helpers\HtmlConfig;

HtmlConfig::$defaultIconsFactory = 'glyphicons';

print IconsFactory::icon('user');
```

Forms
-----

[](#forms)

You can build HTML forms using OOP PHP and easily add business logic. Look at the example below to see how easy it is to build a language select dropdown menu:

```
use Nethead\Markup\MarkupFactory as Html;

$langs = [
    'en_GB' => 'English (British)',
    'pl_PL' => 'Polski'
];

$select = Html::select('locale', $langs);
$select->attrs()
    ->on('change', 'this.form.submit();');

$form = Html::form('/select-locale', 'POST', [$select]);
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 82.1% 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 ~81 days

Recently: every ~112 days

Total

18

Last Release

1116d ago

Major Versions

v1.5 → v2.02021-01-11

PHP version history (2 changes)v1.0PHP ^7.1

v2.0PHP ^7.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9153121?v=4)[kamil17289](/maintainers/kamil17289)[@kamil17289](https://github.com/kamil17289)

---

Top Contributors

[![kamil-nitro](https://avatars.githubusercontent.com/u/120476984?v=4)](https://github.com/kamil-nitro "kamil-nitro (46 commits)")[![kamil17289](https://avatars.githubusercontent.com/u/9153121?v=4)](https://github.com/kamil17289 "kamil17289 (10 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nethead-markup/health.svg)

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

###  Alternatives

[mustache/mustache

A Mustache implementation in PHP.

3.3k44.6M291](/packages/mustache-mustache)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[mopa/bootstrap-bundle

Easy integration of twitters bootstrap into symfony2

7042.9M33](/packages/mopa-bootstrap-bundle)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3871.2M](/packages/limenius-react-bundle)[nicmart/string-template

StringTemplate is a very simple string template engine for php. I've written it to have a thing like sprintf, but with named and nested substutions.

2101.7M30](/packages/nicmart-string-template)

PHPackages © 2026

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