2015-02-25 Laravel
There is a big chance that you might have seen an exception in Laravel 5 that is thrown when Form and / or Html class cannot be found by the framework. It happens because fifth version of it doesn’t come with HtmlServiceProvider. That stops you from using some significant features like for example form helpers.
{!! Form::open() !!} {!! Form::label('test') !!} {!! Form::text('test') !!} {!! Form::close() !!}
Let’s fix this. First open
composer.json
and under require and require-dev sections add illuminate / html package:
"illuminate/html": "~5.0"
Whole section can look like:
"require": { "laravel/framework": "5.0.*", "illuminate/html": "~5.0" }, "require-dev": { "phpunit/phpunit": "~4.0", "phpspec/phpspec": "~2.1", "illuminate/html": "~5.0" },
Next, head to:
/config/app.php
and scroll to providers array. Add new value at the end:
'Illuminate\Html\HtmlServiceProvider',
Now scroll further to reach aliases array and add two key-value pair:
'Form' => 'Illuminate\Html\FormFacade', 'Html' => 'Illuminate\Html\HtmlFacade',
As a final step, open terminal and proceed to the root of your project. Now type
sudo composer update
and then
sudo composer dump-autoload
If you still face some problems, check if your Composer is not too old.