Saturday, June 18, 2016

Laravel Html, Form class not found in Laravel 5

Starting from Laravel 5, Html and Form class were removed by default.



To use it, you can use this package laravelcollective/html (https://laravelcollective.com).

* Suppose that your Laravel project is at C:\wamp\www\test_laravel.

Step 1: edit C:\wamp\www\test_laravel\composer.json file and insert this line

"laravelcollective/html": "5.2.*"

 

Step 2: Open command prompt (CMD) and go to root folder (C:\wamp\www\test_laravel) and type composer update

 

 Note: It take some minute to update it. Please be patient.

Step 3 : Edit file C:\wamp\www\test_laravel\config\app.php and add
Collective\Html\HtmlServiceProvider::class in providers array. 
'providers' => [
        .......
        .......
        Collective\Html\HtmlServiceProvider::class,
    ],
And add 'Form' => Collective\Html\FormFacade::class,'Html' => Collective\Html\HtmlFacade::class,
in aliases array.
    'aliases' => [
        ..............
        ..............
        'Form' => Collective\Html\FormFacade::class,
        'Html' => Collective\Html\HtmlFacade::class,
    ],

That's all. I hope it is working now.

No comments: