New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

fajarsulaksono/laravel-collective-html

HTML and Form Builders for the Laravel Framework
1,014

Larablocks Analysis

fajarsulaksono/laravel-collective-html works with Laravel 9 to 13 (latest release v8.0.0, Jul 27, 2026).

Promising: maintained and up to date, meets 2 of 4 checks; not yet widely used.

  • Works with Laravel 13, the current version
  • Released in the last 12 months (Jul 27, 2026)
  • 499 downloads a month (needs 10,000)
  • 0 GitHub stars (needs 100)

State

Actively maintained
  • Last stable release: Jul 27, 2026.
  • 4 releases in the last 12 months.
  • First released: Jul 27, 2026.
  • Monthly downloads: 499.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 28, 2026.

Install
composer require fajarsulaksono/laravel-collective-html
Latest Version:v8.0.0
PHP:^8.1
Laravel:9 – 13
License:MIT
Last Updated:Jul 27, 2026
Links: GitHub  ·  Packagist
Maintainer: fajarsulaksono

LaravelCollective HTML

Tests Total Downloads Latest Stable Version License

Laravel Collective HTML

HTML and Form Builders for the Laravel Framework.

About

Laravel Form HTML provides convenient helper methods and Blade directives for generating HTML elements and building forms in Laravel. It features automatic CSRF protection, old input repopulation, Eloquent model binding, and custom component support.

This is a maintained fork of the abandoned laravelcollective/html package, updated for Laravel 9/10/11/12/13.

Requirements

Laravel PHP
9.x 8.1, 8.2, 8.3
10.x 8.1, 8.2, 8.3, 8.4
11.x 8.2, 8.3, 8.4
12.x 8.2, 8.3, 8.4
13.x 8.2, 8.3, 8.4

Installation

composer require fajarsulaksono/laravel-collective-html

Laravel will auto-discover the service provider and facades. No manual registration required.

Manual Registration (optional)

If auto-discovery is disabled, add the service provider and facades to your config/app.php:

'providers' => [
    Collective\Html\HtmlServiceProvider::class,
],

'aliases' => [
    'Form' => Collective\Html\FormFacade::class,
    'Html' => Collective\Html\HtmlFacade::class,
],

Usage

HTML Builder

use Collective\Html\HtmlFacade as Html;

// Links
{!! Html::link('/about', 'About Us') !!}
{!! Html::linkRoute('users.index', 'Users') !!}
{!! Html::linkAsset('css/app.css', 'Stylesheet') !!}
{!! Html::mailto('hello@example.com') !!}

// Images
{!! Html::image('logo.png', 'Logo', ['class' => 'logo']) !!}

// Lists
{!! Html::ul(['Item 1', 'Item 2'], ['class' => 'list']) !!}
{!! Html::ol(['First', 'Second']) !!}
{!! Html::dl(['Term' => 'Definition']) !!}

// Meta / Script / Style
{!! Html::meta('csrf-token', csrf_token()) !!}
{!! Html::script('js/app.js') !!}
{!! Html::style('css/app.css') !!}
{!! Html::favicon('favicon.ico') !!}

// Arbitrary tag
{!! Html::tag('div', 'Content', ['class' => 'wrapper']) !!}

Form Builder

use Collective\Html\FormFacade as Form;

// Open a form (auto-generates CSRF token and method spoofing)
{!! Form::open(['route' => 'posts.store']) !!}
{!! Form::close() !!}

// With model binding
{!! Form::model($post, ['route' => ['posts.update', $post->id], 'method' => 'PUT']) !!}
{!! Form::close() !!}

// Text inputs
{!! Form::text('name', 'default value', ['class' => 'form-control']) !!}
{!! Form::password('password') !!}
{!! Form::hidden('id', $post->id) !!}
{!! Form::email('email') !!}
{!! Form::number('age') !!}

// Textarea
{!! Form::textarea('body', null, ['rows' => 10, 'cols' => 50]) !!}

// Select
{!! Form::select('size', ['S' => 'Small', 'M' => 'Medium', 'L' => 'Large'], 'M') !!}

// Select with optgroups
{!! Form::select('city', [
    'Europe' => ['Paris' => 'Paris', 'Berlin' => 'Berlin'],
    'Asia'   => ['Tokyo' => 'Tokyo', 'Seoul' => 'Seoul'],
]) !!}

// Select year / month / range
{!! Form::selectYear('year', 2020, 2030) !!}
{!! Form::selectMonth('month') !!}
{!! Form::selectRange('rating', 1, 5) !!}

// Checkboxes & Radios
{!! Form::checkbox('terms', 1) !!}
{!! Form::radio('color', 'red') !!}

// File upload
{!! Form::file('avatar') !!}

// Buttons
{!! Form::submit('Save', ['class' => 'btn btn-primary']) !!}
{!! Form::button('Cancel', ['type' => 'button']) !!}
{!! Form::reset('Reset') !!}

Model Binding

When using Form::model(), the form will automatically repopulate fields with old input, falling back to model attributes:

{!! Form::model($user, ['route' => ['users.update', $user->id], 'method' => 'PUT']) !!}

    {!! Form::label('name', 'Name') !!}
    {!! Form::text('name') !!}  {{-- Prefilled from old input or $user->name --}}

    {!! Form::label('email', 'Email') !!}
    {!! Form::email('email') !!}  {{-- Prefilled from old input or $user->email --}}

{!! Form::close() !!}

Eloquent Form Mutators

Use the FormAccessible trait to define form-specific accessors:

use Collective\Html\Eloquent\FormAccessible;

class User extends Model
{
    use FormAccessible;

    public function formNameAttribute($value)
    {
        return strtoupper($value);
    }
}

Custom Components

Register custom Blade-view-based components:

// Registration (in a service provider or controller boot method)
Form::component('bsText', 'components.form.text', ['name', 'value', 'attributes']);

// Usage in Blade
{!! Form::bsText('email', null, ['class' => 'form-control']) !!}

Blade Directives

All HTML and Form methods are available as Blade directives using the @html_ or @form_ prefix:

{{-- HTML directives --}}
@html_link('/about', 'About Us')
@html_image('logo.png', 'Logo')
@html_ul(['Item 1', 'Item 2'], ['class' => 'list'])

{{-- Form directives --}}
@form_open(['route' => 'posts.store'])
@form_close
@form_text('name', 'default', ['class' => 'form-control'])
@form_select('size', ['S' => 'Small', 'M' => 'Medium'])
@form_checkbox('terms', 1)
@form_submit('Save')

Helpers

Global helper functions are available for quick access:

link_to('/about', 'About Us');
link_to_asset('css/app.css');
link_to_route('users.index', 'Users');
link_to_action('UserController@index', 'Users');

Testing

composer install
composer test

Contributing

Please see CONTRIBUTING.md for details.

License

MIT License. See LICENSE.txt.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

670,032,257 9,703
laravel/framework

The Laravel Framework.

640,572,096 35,338
laravel/tinker

Powerful REPL for the Laravel framework.

546,909,908 7,440
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

465,816,364 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

431,187,642 4,660

Version History

Version Released PHP Laravel License
v8.0.0 ^8.1 ^9.0|^10.0|^11.0|^12.0|^13.0 MIT
v7.1.0 ^8.1 ^9.0|^10.0|^11.0|^12.0|^13.0 MIT
v7.0.0 ^8.1 ^9.0|^10.0|^11.0|^12.0|^13.0 MIT
v6.1.0 ^8.1 ^9.0|^10.0|^11.0|^12.0|^13.0 MIT