PHPackages                             weblabormx/laravel-html - 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. weblabormx/laravel-html

ActiveLibrary

weblabormx/laravel-html
=======================

A fluent html builder

v1.1(2mo ago)03.9k—2.7%1MITPHPPHP ^8.2

Since Jun 13Pushed 11mo agoCompare

[ Source](https://github.com/weblabormx/laravel-html)[ Packagist](https://packagist.org/packages/weblabormx/laravel-html)[ Docs](https://github.com/spatie/laravel-html)[ Fund](https://spatie.be/open-source/support-us)[ RSS](/packages/weblabormx-laravel-html/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (10)Versions (3)Used By (1)

 [   ![Logo for laravel-html](https://camo.githubusercontent.com/fe6956e41aac8f2cc2eb9074e39118549eb4efc0c733969067f8caddf37b61d9/68747470733a2f2f7370617469652e62652f7061636b616765732f6865616465722f6c61726176656c2d68746d6c2f68746d6c2f6c696768742e77656270)  ](https://spatie.be/open-source?utm_source=github&utm_medium=banner&utm_campaign=laravel-html)Painless HTML generation
========================

[](#painless-html-generation)

[![Latest Version on Packagist](https://camo.githubusercontent.com/09663685a7f9cb51d9c329d50747ec338a90767ad3f590f99b1ca3bf6d9c190b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f6c61726176656c2d68746d6c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-html)[![MIT Licensed](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/5cb46e62d5dcb90797bcd6d69db46f0fb28fb9993ece0588cb939ae8bca24a84/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f6c61726176656c2d68746d6c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-html)

This a fork for spatie/laravel-html. Did some modifications but were not accepted by the author and is required to work with my package weblabormx/laravel-front. [See PR here](https://github.com/spatie/laravel-html/pull/254)

This package helps you generate HTML using a clean, simple and easy to read API. All elements can be dynamically generated and put together. The HTML builder helps you generate dynamically assigned form elements based on your selected model, the session or a default value.

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/dba65b1812a7338b52f692fd847cb6ea0faa19878c57ebb0ee1a4482408c4a15/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f6c61726176656c2d68746d6c2e6a70673f743d31)](https://spatie.be/github-ad-click/laravel-html)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

Postcardware
------------

[](#postcardware)

You're free to use this package (it's [MIT-licensed](LICENSE.md)), but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium.

All postcards are published [on our website](https://spatie.be/en/opensource/postcards).

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

[](#installation)

You can install the package via composer:

```
composer require spatie/laravel-html
```

And optionally register an alias for the facade.

```
// config/app.php
'aliases' => [
    ...
    'Html' => Spatie\Html\Facades\Html::class,
];
```

Usage
-----

[](#usage)

### Concepts

[](#concepts)

Elements—classes under the `Spatie\Html\Elements` namespace—are generally created via a `Spatie\Html\Html` builder instance.

```
html()->span()->text('Hello world!');
```

Element attributes and contents are modified via with fluent methods which return a new instance. This means element instances are immutable.

```
$icon = html()->span()->class('fa');

$icon->class('fa-eye'); // ''
$icon->class('fa-eye-slash'); // ''
```

Element classes don't have any knowledge of the outside world. Any coupling to other concepts, like requests and sessions, should happen in the builder class, not on the element classes.

By convention, we assume that builder methods will modify values to our advantage (like pulling old values from the session on a failed form request), and element methods will be deterministic.

```
// This will try to resolve an initial value, and fall back to 'hello@example.com'
$email = html()->email('email', 'hello@example.com');

// This will always have 'hello@example.com' as it's value
$email = html()->email('email')->value('hello@example.com');
```

Upgrading
---------

[](#upgrading)

### From v1 to v2

[](#from-v1-to-v2)

Version 2 was created because the typehints in version 1 was holding the package back in some cases (like multiple select which requires an array of values instead of a string which was assumed).

Luckily, bumping the version number in `composer.json` and running `composer update` should be non-breaking. Here are some caveats to look out for:

- The package now ships with a `html()` function by default, which returns an instance of the `Html` builder class. If you've defined your own method, you'll need to remove it.
- Various type hints have been removed throughout the package, if you've extended a class to override its methods, you'll need to update them accordingly (everything still behaves the same!)

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you've found a bug regarding security please mail  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Sebastian De Deyne](https://github.com/sebastiandedeyne)
- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)

About Spatie
------------

[](#about-spatie)

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource).

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance67

Regular maintenance activity

Popularity23

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Total

2

Last Release

62d ago

### Community

Maintainers

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

---

Top Contributors

[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (187 commits)")[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (149 commits)")[![alexmanase](https://avatars.githubusercontent.com/u/10696975?v=4)](https://github.com/alexmanase "alexmanase (48 commits)")[![flyingluscas](https://avatars.githubusercontent.com/u/6232791?v=4)](https://github.com/flyingluscas "flyingluscas (10 commits)")[![miken32](https://avatars.githubusercontent.com/u/1329102?v=4)](https://github.com/miken32 "miken32 (8 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (8 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (8 commits)")[![rickselby](https://avatars.githubusercontent.com/u/1564517?v=4)](https://github.com/rickselby "rickselby (7 commits)")[![bskl](https://avatars.githubusercontent.com/u/9579731?v=4)](https://github.com/bskl "bskl (6 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (6 commits)")[![raveren](https://avatars.githubusercontent.com/u/364220?v=4)](https://github.com/raveren "raveren (6 commits)")[![skalero01](https://avatars.githubusercontent.com/u/2976641?v=4)](https://github.com/skalero01 "skalero01 (5 commits)")[![billmn](https://avatars.githubusercontent.com/u/779534?v=4)](https://github.com/billmn "billmn (5 commits)")[![CasperBE](https://avatars.githubusercontent.com/u/22048227?v=4)](https://github.com/CasperBE "CasperBE (5 commits)")[![fdrobnic](https://avatars.githubusercontent.com/u/35068993?v=4)](https://github.com/fdrobnic "fdrobnic (5 commits)")[![azamtav](https://avatars.githubusercontent.com/u/2217592?v=4)](https://github.com/azamtav "azamtav (5 commits)")[![francoism90](https://avatars.githubusercontent.com/u/5028905?v=4)](https://github.com/francoism90 "francoism90 (4 commits)")[![copernitim](https://avatars.githubusercontent.com/u/166406461?v=4)](https://github.com/copernitim "copernitim (4 commits)")[![wesleyhf](https://avatars.githubusercontent.com/u/2936121?v=4)](https://github.com/wesleyhf "wesleyhf (3 commits)")[![jimirobaer](https://avatars.githubusercontent.com/u/8984769?v=4)](https://github.com/jimirobaer "jimirobaer (3 commits)")

---

Tags

spatiehtml

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/weblabormx-laravel-html/health.svg)

```
[![Health](https://phpackages.com/badges/weblabormx-laravel-html/health.svg)](https://phpackages.com/packages/weblabormx-laravel-html)
```

###  Alternatives

[spatie/laravel-query-builder

Easily build Eloquent queries from API requests

4.4k26.9M220](/packages/spatie-laravel-query-builder)[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[spatie/laravel-activitylog

A very simple activity logger to monitor the users of your website or application

5.8k45.4M309](/packages/spatie-laravel-activitylog)[spatie/laravel-honeypot

Preventing spam submitted through forms

1.6k6.0M60](/packages/spatie-laravel-honeypot)[spatie/laravel-backup

A Laravel package to backup your application

6.0k21.8M191](/packages/spatie-laravel-backup)[spatie/laravel-html

A fluent html builder

8376.4M72](/packages/spatie-laravel-html)

PHPackages © 2026

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