These are the steps i have done to enable HTML and Form into laravel 5
I have added illuminate/html
in composer.json
"require": {
"illuminate/html": "~5.0"
},
I added into app.php
in providers
'Illuminate\Html\HtmlServiceProvider',
I also added into app.php
in aliases
'Form' => 'Illuminate\Html\FormFacade',
'Html' => 'Illuminate\Html\HtmlFacade',
And than i updated composer:
php composer update
php composer dump-autoload
Since i have added my controllers the same time i installed html
dependency, i also used dump-autoload but i don't think it has to do anything with html
But i am stil getting the error Class 'HTML' not found
. The error is on line 4 on my header.blade.php file and this is the line when i have included my css files.
I want to note that i am upgrading from laravel 4
This is the line 4 in my header.blade.php
{{ HTML::style('/public/css/bootstrap.min.css') }}
The one thing i noticed when including Html support in laravel 5 that the alias is actually Html
not the HTML
so i have changed HTML
to Html
but it doesn't work.
It doesn't throw an error now but it just output's a raw link to css on top of my page. I can actually see
<link media="all" type="text/css" rel="stylesheet" href="http://localhost/laravel5/public/public/css/bootstrap.min.css">
And i even noticed the error with public/public, i fixed that too, but still this appears on page load, not when i check the source, so it's visible to anyone who load a page.
Ok that kinda makes sense since blade template is changed and now everything inside {{ }} is escaped so it won't load a css in the header it just slam it on the page, i even changed that to {!! !!} but not luck, what am i missing here so i can't load my styles and scripts with HTML anymore.
I was having the same issue. One thing I've noticed that after compose update the html folder appeared under *vendor\illuminate* but not in vendor\laravel\framework\src\Illuminate. Check that destination. Also you may want to check vendor\composer\autoload_classmap.php for newly created HtmlServiceProvider and related aliases. Hope that will help.
You named your alias
'Html' => 'Illuminate\Html\HtmlFacade',
and are trying to access like
{{ HTML::style('/public/css/bootstrap.min.css') }}
either change your alias to HTML or change class call to Html::script()
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community