3

I'm interested in installing Form and HTML classes on Laravel 5 without composer. How can I do this?

For those wanting to convince me to use composer:

1) I want to see what it does by doing it manually myself at least once.

2) There is no composer on my hosting.

3) Using composer.phar throws an error: Script php artisan clear-compiled handling the pre-update-cmd event returned with an error, gives a warning: Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI and runtime exception with blank error output.

Limon Monte
  • 52,539
  • 45
  • 182
  • 213
Alan
  • 1,322
  • 1
  • 21
  • 36
  • you should use composer installed locally, change hosting if you cannot do it there – dynamic Sep 19 '15 at 08:56
  • @dynamic but I do not want to for a reason. Please read my question. – Alan Sep 19 '15 at 08:59
  • When you can't install composer on your webserver then you should better develop on another system where composer works and push the code to the other server. It's much easier to handle – cre8 Sep 19 '15 at 09:29

1 Answers1

5

Installing laracollective/html:

1) Download zip package from extension's git repository

2) Unpack contents and create this directory structure: laravelcollective/html/{contents of html-5.1 directory}

3) Copy this structure to the vendor folder in your Laravel installation.

4) In vendor/composer/autoload_classmap.php add these lines

'Collective\\Html\\FormBuilder' => $vendorDir . '/laravelcollective/html/src/FormBuilder.php',
'Collective\\Html\\FormFacade' => $vendorDir . '/laravelcollective/html/src/FormFacade.php',
'Collective\\Html\\HtmlBuilder' => $vendorDir . '/laravelcollective/html/src/HtmlBuilder.php',
'Collective\\Html\\HtmlFacade' => $vendorDir . '/laravelcollective/html/src/HtmlFacade.php',
'Collective\\Html\\HtmlServiceProvider' => $vendorDir . '/laravelcollective/html/src/HtmlServiceProvider.php',

after

    'ClassPreloader\\Parser\\NodeTraverser' => $vendorDir . '/classpreloader/classpreloader/src/Parser/NodeTraverser.php',

so that Laravel knows where to look for these classes when requested.

5) Add this line as a last element to return array(...) in vendor/composer/autoload_files.php

$vendorDir . '/laravelcollective/html/src/helpers.php',

6) Add this line to return array(...) in vendor/composer/autoload_psr4.php

// 'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'),
'Collective\\Html\\' => array($vendorDir . '/laravelcollective/html/src'),   
// 'ClassPreloader\\' => array($vendorDir . '/classpreloader/classpreloader/src'),

7) Add providers to providers array of config/app.php:

'providers' => [
// ...
Collective\Html\HtmlServiceProvider::class,
// ...

],

8) Add two class aliases to the aliases array of config/app.php:

'aliases' => [
// ...
  'Form' => Collective\Html\FormFacade::class,
  'Html' => Collective\Html\HtmlFacade::class,
// ...

],

References:

http://laravelcollective.com/docs/5.1/html

Alan
  • 1,322
  • 1
  • 21
  • 36