Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Amalmax's avatar

Class 'PDF' not found in domPDF

enconted following error in My Laravel app

FatalErrorException in CollaboPDFController.php line 14:
 Class 'PDF' not found

this is My CollaboPDFController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use PDF;

class CollaboPDFController extends Controller
{
    public function getPDF(){
        $pdf = PDF::loadView('customer.customer'); //line 14
        return $pdf->download('customer.customer');
    }
    //
}

I have customer blade file in customer folder in view directoty how can fix this??

0 likes
11 replies
InaniELHoussain's avatar

are you sure you are registring the alias in the config/app.php

'PDF' => Barryvdh\DomPDF\Facade::class,
Amalmax's avatar

@tomi when I do php artisan config:cache command prompt occurred Class 'Barryvdh\DomPDF\ServiceProvider' not found what is this how can solve this?

Please or to participate in this conversation.