PHP code example of infoway9 / laravel-mpdf
1. Go to this page and download the library: Download infoway9/laravel-mpdf 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/ */
infoway9 / laravel-mpdf example snippets
'providers' => [
// ...
Infoway\mPdf\mPdfServiceProvider::class
]
'aliases' => [
// ...
'PDF' => Infoway\mPdf\Facades\Pdf::class
]
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use PDF;
class HomeController extends Controller {
public function index() {
$data = [
'foo' => 'bar'
];
PDF::loadView('pdf',$data)->download('abc.pdf');
}
}
php artisan vendor:publish --tag=laravel-mpdf