0

i'm trying to use this link http://laravelcollective.com to install HTML and Form helper on laravel 5, after install that with composer like with

"require": {
    "laravelcollective/html": "~5.0"
}

and update composer i'm add this lines on app.php file:

'providers' => [
    /* -------- */
    'Collective\Html\HtmlServiceProvider',
],

'aliases' => [
    /* -------- */
    'Form'      => 'Collective\Html\FormFacade',
    'Html'      => 'Collective\Html\HtmlFacade',
],

and use from Html on view like with :

{{!! HTML::image(Captcha::img(), 'Captcha image',array('id'=>'captcha')) !!}}

I get this error:

Class 'HTML' not found
1
  • 1
    Your alias is Html not HTML! Commented Nov 10, 2015 at 18:40

1 Answer 1

3

It's case-sensitive.

You need to change it to something like:

Html::image(Captcha::img(), 'Captcha image',array('id'=>'captcha'))

Also, use double curly braces {{ }} if you want to escape your HTML. In this case, you probably want to use {!! !!}. I'm not sure why you are doing both.

Edit: As noted by @ceejayoz, you can change the alias if you want to. So, for example, if you change your alias in your config/app.php file to all caps like this:

'HTML'      => 'Collective\Html\HtmlFacade',

Then, you can do this (to reflect your alias):

{!! HTML::image(Captcha::img(), 'Captcha image',array('id'=>'captcha')) !!}
Sign up to request clarification or add additional context in comments.

1 Comment

Good answer. I'd just note that you can also change the alias, if preferred.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.