Installing Laravelcollective/html package in laravel 5.5

2024-03-19 04:51:12 Abhishek Pant Laravel

Laravelcollective/Html Package

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 steps to install Laravelcollective/html package in Laravel 5.5.

Step1:- Install the package by running below composer command in your project directory.

composer require laravelcollective/html

Step2: - Add your new provider to the provider's 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 a form with form helper in Laravel Collective

// 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() !!}


This post is submitted by one of our members. You may submit a new post here.

Related Tricks