Search code examples
laravel-7dompdfphp-8

required parameter $dompdf follows optional parameter $paper - barryvdh/laravel-dompdf


I am trying to render pdf file with dompdf, but I got this issue:

required parameter $dompdf follows optional parameter $paper

image - required parameter $dompdf follows optional parameter $paper


Solution

  • It probably happens because you are using php 8, and your current laravel dompdf doesn't support new changes of php 8.

    To fix it try to use this line in your composer dependency:

    "barryvdh/laravel-dompdf": "^0.9.0"
    

    and run:

    composer update
    

    For more details see:

    https://github.com/barryvdh/laravel-dompdf/issues/747

    And you can see what happens in php-8 with function parameters in this issue:

    Required parameter $xxx follows optional parameter $yyy