PHP code example of sands / laravel-presenter-pdf

1. Go to this page and download the library: Download sands/laravel-presenter-pdf library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sands / laravel-presenter-pdf example snippets


'providers' => [
     ...
     Sands\Presenter\PresenterServiceProvider::class,
     Sands\Presenter\PDF\PDFPresenterServiceProvider::class,
     ...
]

public function index()
{
    return $this->present(['users' => User::all()])
        ->setOption('pdf.view', 'users.pdfs.index')
        ->setOption('pdf.download', false)
        ->setOption('pdf.fileName', 'User Reports')
        ->using('blade', 'pdf');
}