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/mpdfAfter 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 updateI hope you will fix your issue if you follow these instructions.
Thank you for your time.
Connect with KoderSolution 🚀
Master modern software engineering, scalable architectures, and advanced backend systems.
Read more architectural deep-dives, systems tutorials, and engineering guides on kodersolution.com.
Subscribe to @kodersolution for concise, animated system design breakdowns and technical shorts.
Follow our official page for daily development tips, architecture discussions, and community updates.
Callum Davies
PHP & Laravel practitioner since v5.4. Big believer in thin controllers, explicit return types, and boring modular architecture that doesn't page you on weekends.