Reputation: 59
After updating composer with required packages and registering in config/app.php, I've tried laravel-fpdf in laravel 5.3,
composer.json
"require": {
.....
"codedge/laravel-fpdf": "^1.0"
},
providers
Codedge\Fpdf\FpdfServiceProvider::class,
aliases
'Fpdf' => Codedge\Fpdf\Facades\Fpdf::class,
simply in web.php routes like
Route::get('GeneratePdf', function (Codedge\Fpdf\Fpdf\FPDF $fpdf) {
$fpdf->AddPage();
$fpdf->SetFont('Courier', 'B', 18);
$fpdf->Cell(50, 25, 'Hello World!');
$fpdf->Output();
}); And I'm getting error Class Codedge\Fpdf\Fpdf\FPDF does not exist
What could possibly be wrong ?
Upvotes: 1
Views: 4588
Reputation: 85
make sure you rename the file fpdf.php in src/Fpdf so that it start with a capital letter
Upvotes: 0
Reputation: 641
The class name changed from Codedge\Fpdf\Fpdf\FPDF to Codedge\Fpdf\Fpdf\Fpdf
The function name changed. So you can update the previous to use Codedge\Fpdf\Fpdf\Fpdf;
Upvotes: 0
Reputation: 163938
Try to remove service provider and alias from config/app.php
, then run:
composer update
php artisan vendor:publish --provider="Codedge\Fpdf\FpdfServiceProvider" --tag=config
composer dumpauto
Then add service provider and alias back to config/app.php
.
Upvotes: 3