1
votes

Fatal error: Uncaught exception 'ReflectionException' with message 'Class config does not exist' in D:\laragon\www\project\vendor\laravel\framework\src\Illuminate\Container\Container.php:738

I am trying to use dompdf in laravel and according to that documentation.

Lumen:

After updating composer add the following lines to register provider in bootstrap/app.php

$app->register(\Barryvdh\DomPDF\ServiceProvider::class);

To change the configuration, copy the config file to your config folder and enable it in bootstrap/app.php:

$app->configure('dompdf');

and i add that code in bootstrap/app.php like this

$app->register(\Barryvdh\DomPDF\ServiceProvider::class);
$app->configure('dompdf');

but i am geting that error.

3
Is this Lumen, Laravel 5, 5.1 or 5.2 - There are some significant differences between them. Could you clean up the tags or specifically say which you are actually using. You mentioned all of them here.DavidT
Have you run "composer update"UWU_SANDUN
Make sure you don't have .env variables with spaces.Lauri Elias

3 Answers

2
votes

If you don't use Lumen, remove the configuration you've probably done, regarding instructions, in bootsrap/app.php

0
votes

I found this error after using the DomPDF package in laravel. this error comes up whenever I use DomPDF.so that I found one solution for that as below which is worked for me.

comment this line in app_name -> bootstrap -> app.php

$app->register(\Barryvdh\DomPDF\ServiceProvider::class);

comment these 2 lines in app_name -> config -> app.php

  'PDF' => Barryvdh\DomPDF\Facade::class,
  Barryvdh\DomPDF\ServiceProvider::class,

after that into your project run command composer update

execute below commands when the update is done successful,

php artisan clear-compiled 
composer dump-autoload
php artisan optimize

after that reinstall, DomPDF into your project composer require barryvdh/laravel-dompdf uncomment all above 3 lines and run php artisan serve

your project will start running again.

-1
votes
$app->register(\Barryvdh\DomPDF\ServiceProvider::class); 

Added to a error dir,

You should register it in /root/config/app.php,