How to fix Class 'Meneses\LaravelMpdf\LaravelMpdfServiceProvider' not found  in laravel
Laravel

How to fix Class 'Meneses\LaravelMpdf\LaravelMpdfServiceProvider' not found in laravel

Hello everyone, in this post, I will share how to fix recent PDF errors in your Laravel 5,6,7,8, 9 & 10 projects.

Understanding the Error:

The error message "Class 'Meneses\LaravelMpdf\LaravelMpdfServiceProvider' not found" typically occurs when Laravel is unable to locate the service provider for the Laravel MPDF package. This error commonly arises due to misconfigurations or incomplete installations.

If you face this error, you should follow the below instructions.

Step-1: Delete composer.json

Delete the composer.json file from the project. After deleting the composer.json file, you need to install the latest pdf package

Step 2: Verify Composer Installation:

Install the latest version of mPDF. Run below command-

composer require mpdf/mpdf

After running this command, you need to update the composer.

If your Laravel project is below 5.5, you need to manually add providers and aliases:

Step 3: Service Provider Registration:

'providers' => [
Mccarlosen\LaravelMpdf\LaravelMpdfServiceProvider::class,
],
.
.
.
.

'aliases'=>[
'PDF' => Mccarlosen\LaravelMpdf\Facades\LaravelMpdf::class,
],

Step 4: Updating the composer

composer update

I hope you will fix your issue if you follow these instructions.

Thank you for your time.

Get The latest Coding solutions.

Subscribe to the Email Newsletter