skip to Main Content

I’m learning Laravel PHP and I was trying to display some contents like images and audio in a PHP webpage. However, it didn’t display any images but only plain texts. So I tried to install some HTML packages by pasting some lines of codes to composer.json file and app.php file like what they said in Undefined namespace html (adding a css file to blade) laravel. After running XAMPP, I obtained an error:

Class "IlluminateHtmlHtmlServiceProvider" not found

My PHP version is 8.0.8 (latest) and my Laravel version is 8.52.0
Here is my require in composer.json:

"require": {
        "php": "^7.3|^8.0",
        "fideloper/proxy": "^4.4",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^7.0.1",
        "laravel/framework": "^8.40",
        "laravel/tinker": "^2.5",
        "illuminate/html": "~5.0"
    },

And here is the app.php one:

'providers' => [

        /*
         * Laravel Framework Service Providers...
         */
        IlluminateAuthAuthServiceProvider::class,
        IlluminateBroadcastingBroadcastServiceProvider::class,
        IlluminateBusBusServiceProvider::class,
        IlluminateCacheCacheServiceProvider::class,
        IlluminateFoundationProvidersConsoleSupportServiceProvider::class,
        IlluminateCookieCookieServiceProvider::class,
        IlluminateDatabaseDatabaseServiceProvider::class,
        IlluminateEncryptionEncryptionServiceProvider::class,
        IlluminateFilesystemFilesystemServiceProvider::class,
        IlluminateFoundationProvidersFoundationServiceProvider::class,
        IlluminateHashingHashServiceProvider::class,
        //CollectiveHtmlHtmlServiceProvider::class,
        //IlluminateHtmlHtmlServiceProvider::class,
        IlluminateMailMailServiceProvider::class,
        IlluminateNotificadtionsNotificationServiceProvider::class,
        IlluminatePaginationPaginationServiceProvider::class,
        IlluminatePipelinePipelineServiceProvider::class,
        IlluminateQueueQueueServiceProvider::class,
        IlluminateRedisRedisServiceProvider::class,
        IlluminateAuthPasswordsPasswordResetServiceProvider::class,
        IlluminateSessionSessionServiceProvider::class,
        IlluminateTranslationTranslationServiceProvider::class,
        IlluminateValidationValidationServiceProvider::class,
        IlluminateViewViewServiceProvider::class,

        /*
'aliases' => [

        'App' => IlluminateSupportFacadesApp::class,
        'Arr' => IlluminateSupportArr::class,
        'Artisan' => IlluminateSupportFacadesArtisan::class,
        'Auth' => IlluminateSupportFacadesAuth::class,
        'Blade' => IlluminateSupportFacadesBlade::class,
        'Broadcast' => IlluminateSupportFacadesBroadcast::class,
        'Bus' => IlluminateSupportFacadesBus::class,
        'Cache' => IlluminateSupportFacadesCache::class,
        'Config' => IlluminateSupportFacadesConfig::class,
        'Cookie' => IlluminateSupportFacadesCookie::class,
        'Crypt' => IlluminateSupportFacadesCrypt::class,
        'Date' => IlluminateSupportFacadesDate::class,
        'DB' => IlluminateSupportFacadesDB::class,
        'Eloquent' => IlluminateDatabaseEloquentModel::class,
        'Event' => IlluminateSupportFacadesEvent::class,
        'File' => IlluminateSupportFacadesFile::class,
        'Form'=> IlluminateHtmlFormFacade::class,
        'Gate' => IlluminateSupportFacadesGate::class,
        'Hash' => IlluminateSupportFacadesHash::class,
        'Html'=> IlluminateHtmlHtmlFacade::class,
        'Http' => IlluminateSupportFacadesHttp::class,
        'Lang' => IlluminateSupportFacadesLang::class,
        'Log' => IlluminateSupportFacadesLog::class,
        'Mail' => IlluminateSupportFacadesMail::class,
        'Notification' => IlluminateSupportFacadesNotification::class,
        'Password' => IlluminateSupportFacadesPassword::class,
        'Queue' => IlluminateSupportFacadesQueue::class,
        'RateLimiter' => IlluminateSupportFacadesRateLimiter::class,
        'Redirect' => IlluminateSupportFacadesRedirect::class,
        // 'Redis' => IlluminateSupportFacadesRedis::class,
        'Request' => IlluminateSupportFacadesRequest::class,
        'Response' => IlluminateSupportFacadesResponse::class,
        'Route' => IlluminateSupportFacadesRoute::class,
        'Schema' => IlluminateSupportFacadesSchema::class,
        'Session' => IlluminateSupportFacadesSession::class,
        'Storage' => IlluminateSupportFacadesStorage::class,
        'Str' => IlluminateSupportStr::class,
        'URL' => IlluminateSupportFacadesURL::class,
        'Validator' => IlluminateSupportFacadesValidator::class,
        'View' => IlluminateSupportFacadesView::class,

    ],

Please help!

2

Answers


  1. For .css and .js files, you may want to just put them into public/css and public/js folder and then include them in Bladeview templates in your resources/views folder. Them you return this Blade view via the help of controller and view() helper. For more information please consult Laravel document

    Login or Signup to reply.
  2. Do not take this as an attack to you, but I get really frustrated seeing this questions over and over again…

    If you have any problems with a package, ALWAYS go to the source of truth… In this case it would be Packagist (it is the official "source" for composer packages) and it will tell you where it comes from and more…

    So, if you do that, it will get you here and you will see a beautiful red legend saying:

    This package is abandoned and no longer maintained. The author suggests using the laravelcollective/html package instead.

    So, you click that recommended package and you got to a new Packagist page, showing the main repo on the right side (github). When you go to that page, you can see a main page in the readme, so you go there.

    In that page, the first thing you will see is the documentation related to it, and the first "element" it shows is HTML, the one you want to use (showing you the available doc’s versions for laravelcollective/html)…

    So you click on that one and see how it is to just use that class/helper/service…


    One more thing, as the repo or the main page does not say the Laravel versions it support, always check the source code’s composer file. You will see it requires some illuminate/xxxx: ^6.0|^7.0|^8.0, that means that the current Laravel supported version is >= 6.x but not <= 5.8. So Laravel 8 is supported.

    That check works for any package that has a constraint with a Laravel version. If you don’t see any of that, then it should be usable by any Laravel version…

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search