How i use dompdf with laravel without a wrapper

Solution 1:

The latest stable version of laravel/cashier as of this posting is v13.7.0 which requires:
"dompdf/dompdf": "^0.8.6|^1.0.1".
"php": "^7.3|^8.0"

The latest stable version of barryvdh/laravel-dompdf as of this posting is v0.9.0 which requires: "dompdf/dompdf": "^1"
"php": "^7.1 || ^8.0"

It looks a lot like these packages are compatible with each other for recent PHP versions.

Your composer.json file already specifies:
"barryvdh/laravel-dompdf": "^0.9.0"
But your composer.lock file is locking laravel/cashier to version v10.7.1. So basically you just need to update your cachier version from v10.7.1 to a more recent build such as the current latest as of the time of this posting: v13.7.0 (you can specify this in your composer.json file)

You should be able to get by with a simple:
composer update.

You can also trying deleting your composer.lock file so you're not locked down to a specific version then retry installing/updating with either composer install or composer update.
If you need to retain any specific versions of something after deleting the composer.lock file, such as if it breaks code, specify them in your composer.json file.

Edit:

This sounds a lot like you already have laravel-dompdf version 0.8.6 installed, along with laravel/cashier version v10.7.1, and laravel 5, but you're tied down and not able to upgrade stuff at the moment. So unfortunately you're unable to grab laravel-dompdf version 0.9.0. But I don't think that would matter since you're on an older laravel installation.

I think you're just struggling with how to use laravel-dompdf version 0.8.6 which you already have installed:
https://github.com/barryvdh/laravel-dompdf/tree/v0.8.6

You need to make sure you add the service provider to your laravel project's config/app.php file:
Barryvdh\DomPDF\ServiceProvider::class,

Scroll down to the 'providers' => [ section in the file and if it is missing, add the service provider line into there alongside the other service providers you are using.

The service provider provides the dompdf class.
But you NEED to make sure you are constructing it using laravel so it has a chance to handle creation so it can call the service provider.

I see you're trying to run:

Route::get('manual-test-pdf', function () {
  $dompdf = new Dompdf();
  $html = view('pdf.test')->render();
  $dompdf->loadHtml($html);

  return $dompdf->stream();
});

This will not go through the service provider....

As per the readme, you would need to run something like:

$pdf = \App::make('dompdf.wrapper');

You can also try:

$pdf = app('dompdf.wrapper');

That would handle the creation aspect and I'm sure you can figure it out from there.

In terms of trying to get something working, you can try testing with:

Route::get('manual-test-pdf', function () {
    $pdf = \App::make('dompdf.wrapper');
    $pdf->loadHTML('<h1>Test</h1>');
    return $pdf->stream();
});