0

i currently installed laravel and trying to create my first app, however when i required the laravel collective i get error above.

here is my composer.json

{
 "require": {
    "laravel/installer": "~1.1",
    "laravelcollective/html": "5.1.*"
 }
}

and my app.php have these lines.. providers=>

 ...Illuminate\Validation\ValidationServiceProvider::class,
    Illuminate\View\ViewServiceProvider::class,
    Collective\Html\HtmlServiceProvider::class,

aliases=>

 ...'Validator' => Illuminate\Support\Facades\Validator::class,
    'View'      => Illuminate\Support\Facades\View::class,
    'Form'      => Collective\Html\FormFacade::class,
    'Html'      => Collective\Html\HtmlFacade::class,

i've been reading and searching for solutions but currently they never worked for me.. any help will be appreciated.. thanks in advance..

UPDATE this is my cmd as of now.. enter image description here

Limon Monte
  • 52,539
  • 45
  • 182
  • 213
johnguild
  • 435
  • 1
  • 5
  • 25

3 Answers3

1

u have to use php artisan serve inside your project folder. not inside composer folder. for eg, laravel is my project folder inside www directory, so, f:/wamp/www/laravel> php artisan serve

Sunil
  • 95
  • 3
0

Here are the steps I took to install it in my app in Laravel 5.1.

I would suggest you delete the vendor folder for this from your vendor files and remove that line from your composer.json file to start from scratch.

First, require the package:

composer require "illuminate/html":"5.0.*"

Next, add it to your providers:

'providers' => [
    ...

    'Illuminate\Html\HtmlServiceProvider',
],

Finally, add it to your aliases:

'aliases' => [

    ...

    'Form'=> 'Illuminate\Html\FormFacade', 
    'HTML'=> 'Illuminate\Html\HtmlFacade',
],

You can check to see if it has worked by doing the following:

1) php artisan tinker

2) > Form::text('foo')

Which should output "<input name=\"foo\" type=\"text\">"

James
  • 15,754
  • 12
  • 73
  • 91
  • but i read that Illuminate\Html\HtmlServiceProvider is not a core element anymore and should use laravelcollective instead.. is that wrong? – johnguild Oct 13 '15 at 02:38
  • If you are requiring the package and follow those steps it will work fine. But you are correct that it is not a core package anymore. Which is why we are requiring it. – James Oct 13 '15 at 02:44
  • Those are the steps I have taken on multiple Laravel 5.1 apps I have built and it always works 100% – James Oct 13 '15 at 02:44
  • this is what i did, remove the vendor folder, updated the composer.json file with only "laravel/installer": "~1.1", and ran composer update, after that created my app, and did your instructions, however now im recieving Class 'Illuminate\Html\HtmlServiceProvider' not found, :( – johnguild Oct 13 '15 at 02:58
  • Did you remove the classes from `app.php` when you were removing everything? – James Oct 13 '15 at 02:59
  • It sounds like an installation issue. – James Oct 13 '15 at 03:00
  • if that's the case, i think i need to restart from scratch.. thanks for your help and patience @James really appreciated it. – johnguild Oct 13 '15 at 03:02
  • No harm in doing so with a fresh installation. Follow those steps and you should be good as gold. Note, this method uses the `composer require` command and so that will add it to your `composer.json` for you so that you do not need to. If it works then please upvote/accept as answer :) – James Oct 13 '15 at 03:05
0

It seems like you have installed the HTML package and you are trying to use it in your "old" laravel app.

If you install a new app using the composer it should work fine, but if you are trying to use it in your "old" app that you created before installing the form/html collective try to download the files and copy the files in the src folder to the config folder in your app and you are good to go.

Toby Speight
  • 27,591
  • 48
  • 66
  • 103