I ran this:
composer require barryvdh/laravel-dompdf
Then I registered in bootstrap/app.php
:
$app->register(\Barryvdh\DomPDF\ServiceProvider::class);
Then I tried to publish:
php artisan vendor:publish --provider="Barryvdh\DomPDF\ServiceProvider"
.
Then i got big error which bellow:
PHP Fatal error: Uncaught ReflectionException: Class config does not exist in G:\web development all classes\simba2\vendor\laravel\framework\src\Illuminate\Container\Container.php:809
Stack trace:
#0 G:\web development all classes\simba2\vendor\laravel\framework\src\Illuminate\Container\Container.php(809): ReflectionClass->__construct('config')
#1 G:\web development all classes\simba2\vendor\laravel\framework\src\Illuminate\Container\Container.php(691): Illuminate\Container\Container->build('config')
#2 G:\web development all classes\simba2\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(796): Illuminate\Container\Container->resolve('config', Array, true)
#3 G:\web development all classes\simba2\vendor\laravel\framework\src\Illuminate\Container\Container.php(637): Illuminate\Foundation\Application->resolve('config', Array)
#4 G:\web development all classes\simba2\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(781): Illuminate\Container\Container->make('config', Array)
#5 G:\web dev in G:\web development all classes\simba2\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 811
Fatal error: Uncaught ReflectionException: Class config does not exist in G:\web development all classes\simba2\vendor\laravel\framework\src\Illuminate\Container\Container.php:809
Stack trace:
#0 G:\web development all classes\simba2\vendor\laravel\framework\src\Illuminate\Container\Container.php(809): ReflectionClass->__construct('config')
#1 G:\web development all classes\simba2\vendor\laravel\framework\src\Illuminate\Container\Container.php(691): Illuminate\Container\Container->build('config')
#2 G:\web development all classes\simba2\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(796): Illuminate\Container\Container->resolve('config', Array, true)
#3 G:\web development all classes\simba2\vendor\laravel\framework\src\Illuminate\Container\Container.php(637): Illuminate\Foundation\Application->resolve('config', Array)
#4 G:\web development all classes\simba2\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(781): Illuminate\Container\Container->make('config', Array)
#5 G:\web dev in G:\web development all classes\simba2\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 811.
Now when I try to run php artisan ser this
, it shows me the same error.
I think registering
laravel-dompdf
inbootstrap/app.php
is meant forlumen
not forlaravel
.What you need to do is :
first remove this line
$app->register(\Barryvdh\DomPDF\ServiceProvider::class);
from yourbootstrap/app.php
Open
config/app.php
file and incorporate DomPDF service provider in providers array along with DomPDF facade to the aliases array like so :Add
Barryvdh\DomPDF\ServiceProvider::class,
to theproviders
array like below :Add
'PDF' => Barryvdh\DomPDF\Facade::class,
to thealiases
array like below :Save your
config/app.php
Finally Execute the following command to publish the assets from vendor.
This should solve your issue
You can start using
laravel-dompdf
: