Umair Zahid
Umair Zahid

Reputation: 441

Uncaught exception 'ReflectionException' with message 'Class config does not exist' in vendor\laravel\framework\src\Illuminate\Container\Container.php

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.

Upvotes: 2

Views: 4480

Answers (3)

purvisha thakarar
purvisha thakarar

Reputation: 75

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.

Upvotes: 1

Kancho Iliev
Kancho Iliev

Reputation: 701

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

Upvotes: 2

user7006998
user7006998

Reputation: 1

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

Added to a error dir,

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

Upvotes: -1

Related Questions