Facades Laravel Calling Library directly
php is case sensitive, so you need to provide the namespace with capital letters if they are set like this.
$lib = new \Barryvdh\DomPDF\PDF();
should work.
I'm not sure what you have done in the first two lines of code you posted, but you will need to
use Barryvdh\DomPDF\PDF;
right after the namespace declaration in the file you wish to use the code.