There is a laravel wrapper: https://github.com/barryvdh/laravel-dompdf
It even supports using a view to set up the table.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
What is recommended packge for laravel to export table to PDF ?
Will this be good? https://packagist.org/packages/dompdf/dompdf
I also do not know the code to create the table:
This is my guess, is this true?
// reference the Dompdf namespace
use Dompdf\Dompdf;
// instantiate and use the dompdf class
$dompdf = new Dompdf();
$dompdf->loadHtml('<table>');
$dompdf->loadHtml('<tr>');
$dompdf->loadHtml('<th>Company</th>');
$dompdf->loadHtml('<th>Contact</th>');
$dompdf->loadHtml('<th>Country</th>');
$dompdf->loadHtml('</tr>');
Please or to participate in this conversation.