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

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

prabowosd/laravel-collective-html
=================================

HTML and Form Builders for the Laravel Framework (Laravel 10-13 compatible).

v1.1.2(1mo ago)27.3k↑178.1%2MITPHPPHP ^8.2

Since Oct 28Pushed 1mo agoCompare

[ Source](https://github.com/prabowosd/laravel-collective-html)[ Packagist](https://packagist.org/packages/prabowosd/laravel-collective-html)[ Docs](https://github.com/prabowosd/laravel-collective-html)[ RSS](/packages/prabowosd-laravel-collective-html/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (2)Dependencies (24)Versions (5)Used By (2)

Laravel Collective HTML
=======================

[](#laravel-collective-html)

[![Latest Stable Version](https://camo.githubusercontent.com/9187b2ac1edccf20b5985c0b8c5b6d4ae12bdbeff09f1ef05f0e980de69ecf2a/68747470733a2f2f706f7365722e707567782e6f72672f707261626f776f73642f6c61726176656c2d636f6c6c6563746976652d68746d6c2f762f737461626c65)](https://packagist.org/packages/prabowosd/laravel-collective-html)[![Total Downloads](https://camo.githubusercontent.com/0a8bc84c03f0791a1a626d0c989d1d1f1e421d792d27f8f4331a3926281de414/68747470733a2f2f706f7365722e707567782e6f72672f707261626f776f73642f6c61726176656c2d636f6c6c6563746976652d68746d6c2f646f776e6c6f616473)](https://packagist.org/packages/prabowosd/laravel-collective-html)[![License](https://camo.githubusercontent.com/0d0c255d31aa50754918041f3f04b2bfa3a6ed32802dc8534c422be0af023a87/68747470733a2f2f706f7365722e707567782e6f72672f707261626f776f73642f6c61726176656c2d636f6c6c6563746976652d68746d6c2f6c6963656e7365)](https://packagist.org/packages/prabowosd/laravel-collective-html)

HTML and Form Builders for the Laravel Framework, maintained for **Laravel 10, 11, 12, and 13** and **PHP 8.2+ (including PHP 8.4)**.

The `Collective\Html` namespace is retained so the package stays a drop-in replacement for projects already using the classic HTML/Form builders.

On top of the classic API, this fork adds a few conveniences:

- **Validation helpers** — `Form::error()`, `Form::hasError()`, `Form::withValidationClass()`.
- **Selects from enums &amp; models** — `Form::enumSelect()`, `Form::modelSelect()`.
- **Blade components** — ``, ``, `` that bundle label + control + validation feedback.
- **Configurable CSS classes** — Bootstrap by default, remappable via `config/html.php`.

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

[](#installation)

You can install this package via composer:

```
composer require prabowosd/laravel-collective-html
```

Documentation
-------------

[](#documentation)

The API mirrors the classic Laravel HTML/Form builders — `Form::` and `Html::` facades behave as documented in the long-standing HTML builder docs.

Quick Start
-----------

[](#quick-start)

### Form Open

[](#form-open)

```
{!! Form::open(['url' => 'foo/bar']) !!}
    //
{!! Form::close() !!}
```

### Label

[](#label)

```
{!! Form::label('email', 'E-Mail Address') !!}
```

### Text, Text Area, Password &amp; Hidden Fields

[](#text-text-area-password--hidden-fields)

```
{!! Form::text('username') !!}
{!! Form::textarea('description') !!}
{!! Form::password('password') !!}
{!! Form::hidden('invisible', 'secret') !!}
```

### Checkboxes and Radio Buttons

[](#checkboxes-and-radio-buttons)

```
{!! Form::checkbox('name', 'value') !!}
{!! Form::radio('name', 'value') !!}
```

### Drop-Down Lists

[](#drop-down-lists)

```
{!! Form::select('size', ['L' => 'Large', 'S' => 'Small']) !!}
```

### Buttons

[](#buttons)

```
{!! Form::submit('Click Me!') !!}
```

Validation Errors
-----------------

[](#validation-errors)

These helpers read the validation error bag that Laravel shares with every view (the `$errors` `MessageBag`). Array-style field names are resolved to dot notation automatically, so `person[name]` maps to the `person.name` error key.

```
{{-- Render the feedback element only when the field has an error --}}
{!! Form::error('email') !!}            // The email field is required.

@if (Form::hasError('email'))
    ...
@endif

{{-- First error message, or null --}}
{{ Form::getError('email') }}

{{-- Append the "invalid" class to your own options when the field errors --}}
{!! Form::text('email', null, Form::withValidationClass('email', ['class' => 'form-control'])) !!}
```

The classic `Form::` calls are left untouched — the invalid class is only added when you opt in through `withValidationClass()` (or through the Blade components below).

Selects From Enums &amp; Models
-------------------------------

[](#selects-from-enums--models)

```
{{-- PHP enum: backed enums use their value; a label() method is honored, --}}
{{-- otherwise the case name is humanized.                                 --}}
{!! Form::enumSelect('status', App\Enums\OrderStatus::class, $selected) !!}

{{-- Eloquent: pass a model class, query/relation, collection, or array --}}
{!! Form::modelSelect('category_id', App\Models\Category::class, 'name', 'id', $selected) !!}
{!! Form::modelSelect('category_id', $categories /* a Collection */, 'title', 'uuid') !!}
```

Add a label provider to an enum to control option text:

```
enum OrderStatus: string
{
    case Pending = 'pending';
    case Shipped = 'shipped';

    public function label(): string
    {
        return ucfirst($this->value);
    }
}
```

Blade Components
----------------

[](#blade-components)

Class-based components that compose a label, the control, and the validation feedback in one tag. Pass-through HTML attributes (`placeholder`, `class`, `data-*`, …) are merged onto the control.

```

```

When a field has a validation error, components automatically add the configured `invalid` class to the control and render the feedback element after it.

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

[](#configuration)

The CSS classes used for controls and validation state default to Bootstrap. Publish the config to remap them (e.g. for Tailwind with `@tailwindcss/forms`):

```
php artisan vendor:publish --tag=html-config
```

```
// config/html.php
return [
    'classes' => [
        'control' => 'form-control',
        'select' => 'form-select',
        'label' => 'form-label',
        'invalid' => 'is-invalid',
        'feedback' => 'invalid-feedback',
        'check_wrapper' => 'form-check',
        'check_input' => 'form-check-input',
        'check_label' => 'form-check-label',
    ],
];
```

Testing
-------

[](#testing)

```
composer test      # phpunit
composer format    # pint
composer lint      # pint --test
```

License
-------

[](#license)

The Laravel Collective HTML package is open-sourced software licensed under the [MIT license](LICENSE.txt).

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance92

Actively maintained with recent releases

Popularity28

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% 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 ~70 days

Total

4

Last Release

38d ago

Major Versions

1.1.1 → 13.0.12026-03-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/01a1a8078c3e4fd8de7f9c2e3a63166d117d44e14367b84bb60a93b060ff2e1a?d=identicon)[prabowosd](/maintainers/prabowosd)

---

Top Contributors

[![prabowosd](https://avatars.githubusercontent.com/u/5931987?v=4)](https://github.com/prabowosd "prabowosd (12 commits)")[![mauriziofonte](https://avatars.githubusercontent.com/u/1758841?v=4)](https://github.com/mauriziofonte "mauriziofonte (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k29.9M146](/packages/laravel-cashier)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M132](/packages/laravel-pulse)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)

PHPackages © 2026

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