You can install the package via composer:
composer require spatie/laravel-pdf
Under the hood this package uses Browsershot to generate PDFs. You'll need to install the required dependencies for Browsershot to work. You can find the instructions here.