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

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

orchestra/html
==============

HTML Component for Orchestra Platform

v6.1.0(5y ago)40112.8k—8.3%9[4 issues](https://github.com/orchestral/html/issues)2MITPHPPHP ^7.3 || ^8.0

Since Jun 19Pushed 5y ago3 watchersCompare

[ Source](https://github.com/orchestral/html)[ Packagist](https://packagist.org/packages/orchestra/html)[ Docs](http://orchestraplatform.com/docs/latest/components/html/)[ Fund](https://paypal.me/crynobone)[ Fund](https://liberapay.com/crynobone)[ RSS](/packages/orchestra-html/feed)WikiDiscussions 6.x Synced yesterday

READMEChangelog (10)Dependencies (7)Versions (78)Used By (2)

HTML Component for Orchestra Platform
=====================================

[](#html-component-for-orchestra-platform)

HTML Component extends the functionality of `Illuminate\Html` with the extra functionality to including a chainable Form and Table builder. These set of functionality are the backbone in allowing extensions in Orchestra Platform to attach action to any existing form or table.

[![tests](https://github.com/orchestral/html/workflows/tests/badge.svg?branch=6.x)](https://github.com/orchestral/html/actions?query=workflow%3Atests+branch%3A6.x)[![Latest Stable Version](https://camo.githubusercontent.com/16e0c810e3776bc5d9b90e12c8c1a4908b7744a08c53d331ae1899e045c454e5/68747470733a2f2f706f7365722e707567782e6f72672f6f72636865737472612f68746d6c2f76657273696f6e)](https://packagist.org/packages/orchestra/html)[![Total Downloads](https://camo.githubusercontent.com/116a6240bd938596e778ef975266919d5e155e4dbb21caafeb1be0873d8213d9/68747470733a2f2f706f7365722e707567782e6f72672f6f72636865737472612f68746d6c2f646f776e6c6f616473)](https://packagist.org/packages/orchestra/html)[![Latest Unstable Version](https://camo.githubusercontent.com/38431f2c9c2ecf7b81ed9347dcb13232e158119780fd1be3946af6cf65fd6cf6/68747470733a2f2f706f7365722e707567782e6f72672f6f72636865737472612f68746d6c2f762f756e737461626c65)](//packagist.org/packages/orchestra/html)[![License](https://camo.githubusercontent.com/dfa08606c79e6857497e2ceda40516f6e35aa90bbd8b271395545b6cbdcf9469/68747470733a2f2f706f7365722e707567782e6f72672f6f72636865737472612f68746d6c2f6c6963656e7365)](https://packagist.org/packages/orchestra/html)[![Coverage Status](https://camo.githubusercontent.com/237a956b2824d96fd4efe25b44535db3c8916d36b766fc9526703f87294a3a9f/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6f72636865737472616c2f68746d6c2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/orchestral/html?branch=master)

Version Compatibility
---------------------

[](#version-compatibility)

LaravelHTML5.5.x3.5.x5.6.x3.6.x5.7.x3.7.x5.8.x3.8.x6.x4.x7.x5.x8.x6.xInstallation
------------

[](#installation)

To install through composer, run the following command from terminal:

```
composer require "orchestra/html"
```

Configuration
-------------

[](#configuration)

Next add the service provider in `config/app.php`.

```
'providers' => [

    // ...

    Orchestra\Html\HtmlServiceProvider::class,
],
```

### Aliases

[](#aliases)

You might want to add the following to class aliases in `config/app.php`:

```
'aliases' => [

    // ...

    'Form' => Orchestra\Support\Facades\Form::class,
    'HTML' => Orchestra\Support\Facades\HTML::class,
    'Table' => Orchestra\Support\Facades\Table::class,
],
```

Usage
-----

[](#usage)

`Orchestra\Html\HtmlBuilder` is a small improvement from `Illuminate\Html\HtmlBuilder`.

> Advise to use this only when manipulating HTML outside of view, otherwise it's better (and faster) to use html.

Create HTML
-----------

[](#create-html)

Create a HTML tag from within your libraries/extension using following code:

```
return HTML::create('p', 'Some awesome information');
```

Will return `Some awesome information`.

You can customize the HTML attibutes by adding third parameter.

```
return HTML::create('p', 'Another awesomeness', ['id' => 'foo']);
```

Will return `Another awesomeness`.

Raw HTML Entities
-----------------

[](#raw-html-entities)

Mark a string to be excluded from being escaped.

```
return HTML::link('foo', HTML::raw(''));
```

Will return ``.

This also can be dynamically done via.

```
return HTML::link('foo', HTML::image('foo.jpg'));
```

Decorate HTML
-------------

[](#decorate-html)

Decorate method allow developer to define HTML attributes collection as `HTML::attributes` method, with the addition of including default attributes array as second parameter.

```
return HTML::decorate(['class' => 'foo'], ['id' => 'foo', 'class' => 'span5']);
```

Will return `array('class' => 'foo span5', 'id' => 'foo');`.

It also support replacement of default attributes if such requirement is needed.

```
return HTML::decorate(['class' => 'foo !span5'], ['class' => 'bar span5']);
```

Will return `array('class' => 'foo bar');`, note that `span5` is excluded when we give `!span5` in the first parameter.

Forms
-----

[](#forms)

Creating forms couldn't be any easier using Orchestra's HTML package. Let's get started.

##### Creating a new Form

[](#creating-a-new-form)

To create a new form, use the `Form::of()` method. The first parameter is simply a string to define what the form is for:

```
return Form::of('users');
```

##### Form Attributes

[](#form-attributes)

To customize your forms attributes, call the `attributes($attributes)` method on the `FormGrid` instance:

```
return Form::of('users', function ($form) {
    $attributes = [
        'method' => 'PATCH',
        'id'     => 'user-login-form',
        'class'  => 'form-horizontal',
    ];

    $form->attributes($attributes);
});
```

##### Specifying the Form layout

[](#specifying-the-form-layout)

To specify the layout of the form, call the `layout($view)` method on the `FormGrid` instance:

```
return Form::of('users', function ($form) {
    $form->layout('layouts.form');
});
```

##### Adding Fields

[](#adding-fields)

To add fields to our form, we'll pass in a closure into the second parameter, and call the `fieldset()` method off of the injected FormGrid. Here's an example:

```
return Form::of('users', function ($form) {
    $form->fieldset(function ($fieldset) {
        $fieldset->control('input:text', 'username');
        $fieldset->control('input:email', 'email');
        $fieldset->control('input:password', 'password');
    });
});
```

###### Available Fields

[](#available-fields)

```
// A text field
$form->control('input:text', 'name');

// A password field
$form->control('input:password', 'name');

// A file field
$fieldset->control('input:file', 'name');

// A textarea filed
$form->control('textarea', 'name');

// A select field
$form->control('select', 'name')
    ->options(['one', 'two', 'three']);
```

##### Adding Labels to Fields

[](#adding-labels-to-fields)

To add a label onto a form control, use the method `label()`:

```
$form->fieldset(function ($fieldset) {
    $form->control('input:text', 'username')
        ->label('Username');

    $form->control('input:email', 'email')
        ->label('Email');

    $form->control('input:password', 'password')
        ->label('Password');
});
```

##### Adding Default Values to Fields

[](#adding-default-values-to-fields)

To add a default value to the field, use the method `value()` on the form control:

```
$form->fieldset(function ($fieldset) {
    $form->control('input:text', 'username')
        ->label('Username')
        ->value(Auth::user()->username);

    $form->control('input:email', 'email')
        ->label('Email')
        ->value(Auth::user()->email);

    $form->control('input:password', 'password')
        ->label('Password');
});
```

##### Changing the submit button label

[](#changing-the-submit-button-label)

To change the submit button label, modify the FormGrid property `submit` like so:

```
return Form::of('users', function ($form) {
    // The form submit button label
    $form->submit = 'Save';

    $form->fieldset(function ($fieldset) {
        $form->control('input:text', 'username');
        $form->control('input:email', 'email');
        $form->control('input:password', 'password');
    });
});
```

##### Customizing the form control attributes

[](#customizing-the-form-control-attributes)

To customize the form controls attributes, call the `attributes($attributes)` method on the control:

```
$attributes = [
    'placeholder' => 'Enter your username',
    'class'       => 'form-control',
];

$form->control('input:text', 'username')
    ->attributes($attributes);
```

##### Customizing the form control itself

[](#customizing-the-form-control-itself)

```
$form->control('input:email', 'email', function ($control) {
    $control->field(function ($row) {
        return "";
    });
});
```

You could also create a `Renderable` class:

```
use Illuminate\Contracts\Support\Renderable;

class EmailAddressField implements Renderable
{
    public function __construct($name, $value)
    {
        $this->name = $name;
        $this->value = $value;
    }

    public function render()
    {
        return sprintf('', $this->name, $this->value);
    }
}
```

And you can simply register it via:

```
$form->control('input:email', 'email', function ($control) {
    $control->field(function ($row) {
        return new EmailAddressField('email', $row->email);
    });
});
```

##### Displaying your form

[](#displaying-your-form)

To display your form, simply display it in your view with unescaped blade tags:

```
public function index()
{
    $form = Form::of('users', function ($form) {
        $form->fieldset(function ($fieldset) {
            $form->control('input:text', 'username');
            $form->control('input:email', 'email');
            $form->control('input:password', 'password');
        });
    });

    return view('index', compact('form'));
}
```

```
// In index.blade.php

{!! $form !!}
```

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 95.5% 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 ~38 days

Total

77

Last Release

1873d ago

Major Versions

v2.2.4 → v3.0.02015-02-05

3.8.x-dev → v4.0.02019-09-03

v4.1.0 → v5.0.02020-03-06

v4.1.1 → v5.0.12020-12-27

5.x-dev → v6.0.02020-12-27

PHP version history (9 changes)v2.0.0PHP &gt;=5.3.3

v2.2.0PHP &gt;=5.4.0

v3.1.1PHP &gt;=5.5.0

v3.3.0PHP &gt;=5.6.0

v3.5.0PHP &gt;=7.0

v3.6.0PHP &gt;=7.1

v4.0.0PHP &gt;=7.2

v6.0.0PHP &gt;=7.3

v6.1.0PHP ^7.3 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/172966?v=4)[Mior Muhammad Zaki](/maintainers/crynobone)[@crynobone](https://github.com/crynobone)

---

Top Contributors

[![crynobone](https://avatars.githubusercontent.com/u/172966?v=4)](https://github.com/crynobone "crynobone (782 commits)")[![stevebauman](https://avatars.githubusercontent.com/u/6421846?v=4)](https://github.com/stevebauman "stevebauman (19 commits)")[![hostbrute](https://avatars.githubusercontent.com/u/10145071?v=4)](https://github.com/hostbrute "hostbrute (8 commits)")[![wisepotato](https://avatars.githubusercontent.com/u/1401260?v=4)](https://github.com/wisepotato "wisepotato (4 commits)")[![alexandre-butynski](https://avatars.githubusercontent.com/u/671662?v=4)](https://github.com/alexandre-butynski "alexandre-butynski (2 commits)")[![jonasof](https://avatars.githubusercontent.com/u/5995209?v=4)](https://github.com/jonasof "jonasof (2 commits)")[![vlakoff](https://avatars.githubusercontent.com/u/544424?v=4)](https://github.com/vlakoff "vlakoff (1 commits)")[![simondubois](https://avatars.githubusercontent.com/u/9416595?v=4)](https://github.com/simondubois "simondubois (1 commits)")

---

Tags

laravelhtmlformtableorchestra-platformorchestral

### Embed Badge

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

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

###  Alternatives

[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[anahkiasen/former

A powerful form builder

1.4k1.4M14](/packages/anahkiasen-former)[vinkius-labs/laravel-page-speed

Laravel Page Speed

2.5k12.5k1](/packages/vinkius-labs-laravel-page-speed)[orchestra/asset

Asset Component for Orchestra Platform

54178.0k4](/packages/orchestra-asset)[orchestra/memory

Memory Component for Orchestra Platform

11150.2k11](/packages/orchestra-memory)

PHPackages © 2026

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