Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ruchit288's avatar

LaravelCollective/HTML in Laravel 5.3

Hello Team, Currently i am working in Laravel5.3, i had tried to installed "laravelcollective/html": "5.3.*" through composer and also add required declaration in config/app.php, but when i run my application it throws an error Class "Form" not found or "HTML" not found ? Please help me on this.

Thanks, Ruchit

0 likes
19 replies
Hesto's avatar

@ruchit288 Did you register facades too?

'aliases' => [
    // ...
      'Form' => Collective\Html\FormFacade::class,
      'Html' => Collective\Html\HtmlFacade::class,
    // ...
  ],
ruchit288's avatar

Hello, Yea I already declared form and html facade in app.php. But still doesn't work.

Thanks

bestmomo's avatar

Try composer dumpautoload to regenerate autoload.

ruchit288's avatar

I already execute composer dumpautoload command after declaring laravelCollective in config\app.php

Thanks.

ruchit288's avatar

Hello

composer.json

"require": { "php": ">=5.6.4", "laravel/framework": "5.3.", "laravelcollective/html": "5.3." },

config\app.php

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

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

still i face error Class "Form" not found.

Thanks.

jekinney's avatar

Probably not fully updated yet. But I quit using the helpers years ago. Performance hog.

1 like
ruchit288's avatar

Hello, Same thing work in laravel 5.2 but not work in laravel5.3

Thanks

zachleigh's avatar

Quitting the form helpers was the best thing I ever did. Why wait for a third party app to be updated to do basic html stuff?

5 likes
ruchit288's avatar

Hello, So any other options apart form laravelCollective or third party app ?

Thanks

jekinney's avatar

Look at the form class. All it does is output HTML. So you call a php class and function which while compiling the view, has to look you the class, find the method, do its work just to output HTML.

Look at Form::close(). It outputs '/form. Really need to call a class and method to do that?

bestmomo's avatar

Laravelcollective/html is working fine for me on 5.3.

I like it to generate csrf_token and form method spoofing. Also I extend the library with custom methods to generate all CSS classes. So I have more clean views.

majad.shohagh's avatar

composer.json

"require": { "php": ">=5.6.4", "laravel/framework": "5.3.", "laravelcollective/html": "5.3." },

Than update your composer composer update Than work next step

config\app.php

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

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

Thanks.

neil.rupert's avatar

Your class has to match your facade.

'HTML' => Collective\Html\HtmlFacade::class      ----->     {{ HTML::link('link', 'Pretty Link - click here!') }}

OR

'Html' => Collective\Html\HtmlFacade::class      ----->     {{ Html::link('link', 'Pretty Link - click here!') }}
recurse's avatar

For whatever reason, I had the Laravel configuration cached, so I didn't think about running this:

$ php artisan config:cache

or better yet turn config caching off completely on your machine since you don't need it:

$ php artisan config:clear
2 likes
mfarooq's avatar

composer.json

"require": { "php": ">=5.6.4", "laravel/framework": "5.3.", "laravelcollective/html": "5.3." },

config\app.php

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

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

then try this command composer require laravelcollective/html this will solve error.

MalaniDerrick's avatar

composer.json

"require": { "php": ">=5.6.4", "laravel/framework": "5.3.", "laravelcollective/html": "5.3." },

config\app.php

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

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

then try this command composer require laravelcollective/html this will solve error.

1 like
jhansi's avatar

Install html via composer as:

composer require laravelcollective/html 5.3
mujjtahidah's avatar

maybe your html structure, i try this ... (add !!)

{!! Form::model($data, array('route' => array('data.update', $data->id), 'method' => 'PUT')) !!}

<div class="form-group">
    {!! Form::label('nama_data', 'Nama Data') !!}
    {!! Form::text('nama_data', null, array('class' => 'form-control')) !!}
</div>

<div class="form-group">
    {!! Form::label('detail_data', 'Detail Data') !!}
    {!! Form::email('detail_data', null, array('class' => 'form-control')) !!}
</div>

{!! Form::submit('Edit the Nerd!', array('class' => 'btn btn-primary')) !!}

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

Please or to participate in this conversation.