nacha's avatar
Level 2

Class 'Collective\Html\HtmlServiceProvider' not found

I did run composer require laravelcollective/html

Then I added to config/app.php

Inside Providers

Collective\Html\HtmlServiceProvider::class,

Inside aliases

'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,

but I get this:

Class 'Collective\Html\HtmlServiceProvider' not found

log:

local.ERROR: Class 'Collective\Html\HtmlServiceProvider' not found {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Class 'Collective\Html\HtmlServiceProvider' not found at C:\wamp\www\site\vendor\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php:208)
[stacktrace]
#0 C:\wamp\www\site\vendor\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php(144): Illuminate\Foundation\ProviderRepository->createProvider('Collective\\Html...')
#1 C:\wamp\www\site\vendor\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php(61): Illuminate\Foundation\ProviderRepository->compileManifest(Array)
#2 C:\wamp\www\site\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(584): Illuminate\Foundation\ProviderRepository->load(Array)
#3 C:\wamp\www\site\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\RegisterProviders.php(17): Illuminate\Foundation\Application->registerConfiguredProviders()
#4 C:\wamp\www\site\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(210): Illuminate\Foundation\Bootstrap\RegisterProviders->bootstrap(Object(Illuminate\Foundation\Application))
#5 C:\wamp\www\site\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(162): Illuminate\Foundation\Application->bootstrapWith(Array)
#6 C:\wamp\www\site\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(146): Illuminate\Foundation\Http\Kernel->bootstrap()
#7 C:\wamp\www\site\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#8 C:\wamp\www\site\public\index.php(55): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#9 {main}
"} 

how to solve that thank you

0 likes
10 replies
TomislavLazar's avatar

On your CLI run:

$ composer dump-autoload

then run:

$ composer update

worked for me :)

If that doesn't work try to clear laravel cache.

    sudo rm -fr bootstrap/cache/*
    sudo php artisan route:clear
    sudo php artisan cache:clear
    sudo php artisan view:clear
    sudo php artisan config:clear
    php artisan clear-compiled
    composer dump-autoload
TomislavLazar's avatar

Also what came across my mind.

You could try this solution.

Try commenting "Collective\Html\HtmlServiceProvider::class" from providers and aliases you've added then run following:

composer require laravelcollective/html

Reason is that class doesn't exist yet and you are trying to call reference it.

Clear cache then it should work fine.

1 like
nacha's avatar
Level 2

thank you @tomislavlazar

when I type this " composer require laravelcollective/html " I get this

composer require laravelcollective/html
Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2.0 is now available and you should upgrade. See https://getcomposer.org/2
Using version ^6.2 for laravelcollective/html
./composer.json has been updated
Loading composer repositories with package information      
Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2.0 is now available and you should upgrade. See https://getcomposer.org/2
Updating dependencies (including require-dev)

VirtualAlloc() failed: [0x00000008] Les ressources mmoire disponibles sont insuffisantes pour traiter cette commande.


VirtualAlloc() failed: [0x00000008] Les ressources mmoire disponibles sont insuffisantes pour traiter cette commande.   


Fatal error: Out of memory (allocated 991952896) (tried to allocate 25165832 bytes) in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/RuleSet.php on line 84

and when I type this "composer update" I get this

VirtualAlloc() failed: [0x00000008] Les ressources mmoire disponibles sont insuffisantes pour traiter cette commande.   


Fatal error: Out of memory (allocated 991952896) (tried to allocate 25165832 bytes) in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/RuleSet.php on line 84

but if I type "composer dump-autoload" I get this

composer dump-autoload
Generating optimized autoload files> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In ProviderRepository.php line 208:

  Class 'Collective\Html\HtmlServiceProvider' not found     


Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
Tray2's avatar
Tray2
Best Answer
Level 74

Do yourself a favor and don't use that crap, it's much better to use regular html to create your forms. You will run into more problems if you use it and the response you will get here is to not use it.

1 like
nacha's avatar
Level 2

thank you @tray2 I think you are right (but maybe there's solution for that that's why I try to use it and found solution for this error to help anyone need that or want to use it) and I think I will not use it( just if I find a solution) and thank you for your advice

Snapey's avatar

Don’t use Laravel Collective

Pay attention to the messages and upgrade to composer 2

1 like
Tray2's avatar

To update composer you need to run composer selfupdate

Please or to participate in this conversation.