Installing Laravelcollective/html package in laravel 5.4

Installing Laravelcollective/html package in laravel 5.4

In order to use form helpers in Laravel 5, you need to install Laravelcollective/html package. Laravel’s Laravelcollective/html package is HTML and Form Builders Package for the Laravel Framework. Below are step to install Laravelcollective/html package in Laravel 5.4.
Step1 :- Install the package by running below composer command in your project directory.

composer require laravelcollective/html
Installing Laravelcollective/html package in laravel 5.4

Step2 :-Add your new provider to the providers array of config/app.php


'CollectiveHtmlHtmlServiceProvider',

Step3 :-Add two class aliases to the aliases array of config/app.php:


'Form' => 'CollectiveHtmlFormFacade',
'Html' => 'CollectiveHtmlHtmlFacade',

You have done , Now you can use Form and Html helpers in your view.Below is sample usage to create an form with form helper


// Opening/creating a form
{!! Form::open(array('route' => 'employee.store','method'=>'POST')) !!}

// creating a text box
{!! Form::text('title', null, array('placeholder' => 'Title','class' => 'form-control')) !!}

// creating a textarea
{!! Form::textarea('description', null, array('placeholder' => 'Description','class' => 'form-control','style'=>'height:100px')) !!}

// Closing a form
{!! Form::close() !!}

Leave a Reply

Your email address will not be published. Required fields are marked *