The updated mpdf-bundle (v3.0.1) maintains strong alignment with Laravel’s architecture but now explicitly targets Symfony 8 while retaining backward compatibility with Symfony 7. Key architectural shifts include:
AbstractBundle and PHP 8.4+ features (e.g., mPDF ^8.2.5), making it ideal for:
MpdfFactory is now a private service, enforcing dependency injection (DI) discipline while preserving type-hint injection in controllers. This aligns with Laravel’s service container best practices.config/services.php simplifies Laravel’s configuration merging logic (e.g., config('mpdf')).Caveats:
^8.2.5 constraint drops support for older mPDF versions, which may affect custom builds.High for Laravel 11+, Medium for Laravel 10 (Symfony 7 path), Low for Laravel <10.
mPDF ^8.2.1).AbstractBundle and PHP 8.4+ optimizations (e.g., named arguments) may not impact Laravel directly but future-proof the stack.AppServiceProvider).config/services.php integrates seamlessly with Laravel’s config() helper but may require updating custom config logic.Potential Challenges:
^8.2.5 may break custom mPDF patches or older extensions.AbstractBundle optimizations).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| PHP 8.4 Upgrade | High | Test all dependencies for PHP 8.4 compatibility; use phpunit/phpunit:^10.5 for CI. |
| Private Service | Medium | Update AppServiceProvider to bind MpdfFactory explicitly if not using autowiring. |
| mPDF Version Conflict | Medium | Audit custom mPDF logic for compatibility with ^8.2.5. |
| Symfony 8 Features | Low | Focus on Laravel 11+ for full Symfony 8 benefits; Laravel 10 will use Symfony 7 path. |
| Config Migration | Low | Use config('mpdf') with array_merge to handle PHP/YAML config transitions. |
^8.2.5?MpdfFactory (e.g., in AppServiceProvider)? If so, update to reflect the private service.Primary Fit:
Secondary Fit:
composer require bideogemu/mpdf-bundle:^3.0.1
MpdfFactory, update AppServiceProvider:
$this->app->bind(MpdfFactory::class, function ($app) {
return new MpdfFactory($app['config']['mpdf']);
});
config/services.php to use PHP-based config (if customizing):
return [
'mpdf' => [
'default_options' => ['margin' => 10],
'cache_dir' => storage_path('app/mpdf_cache'),
],
];
<8.2.5 features.Backward Compatibility: Partial.
MpdfFactory service (requires explicit binding if not using autowiring).mPDF ^8.2.5 constraint (may break custom mPDF logic).Laravel-Specific Notes:
config('mpdf') for bundle options (PHP config is now the source of truth).MpdfFactory or bind it manually.MpdfFactory usage behind a feature flag during migration:
if (config('features.mpdf_v3')) {
$mpdf = app(MpdfFactory::class)->create($options);
} else {
$mpdf = new \Mpdf\Mpdf($options); // Fallback
}
^8.2.5.MpdfFactory is bound in the container (use app()->bound(MpdfFactory::class)).How can I help you explore Laravel packages today?