Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

curtsheller's avatar

Target class [DompdfInvoiceRenderer] does not exist

Getting this error with Spark when trying to download PDF. Dot have "dompdf/dompdf": "^2.0" installed.

Target class [DompdfInvoiceRenderer] does not exist

Can't find solution in Spark, Cashier, or "dompdf/dompdf" repro.

0 likes
13 replies
AddWebContribution's avatar

@curtsheller have you followed the required version for dom-pdf if you are using laravel 5 then you need to use 0.5x version of dompdf check with current version which you have installed

  "require": { 
           ... 
            "barryvdh/laravel-dompdf": "0.5.*"
   }
Sinnbeck's avatar

What is the full error? Can you show some code?

curtsheller's avatar

Here is the error and a few of the calls:

Target class [DompdfInvoiceRenderer] does not exist. {"exception":"[object] (Illuminate\Contracts\Container\BindingResolutionException(code: 0): Target class [DompdfInvoiceRenderer] does not exist. at /home/forge/learningukulele.com/vendor/laravel/framework/src/Illuminate/Container/Container.php:895) [stacktrace]

#0 /home/forge/learningukulele.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(774): Illuminate\Container\Container->build()

#1 /home/forge/learningukulele.com/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(860): Illuminate\Container\Container->resolve()

#2 /home/forge/learningukulele.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(710): Illuminate\Foundation\Application->resolve()

#3 /home/forge/learningukulele.com/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(845): Illuminate\Container\Container->make()

#4 /home/forge/learningukulele.com/vendor/laravel/cashier/src/CashierServiceProvider.php(82): Illuminate\Foundation\Application->make()

#5 /home/forge/learningukulele.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(889): Laravel\Cashier\CashierServiceProvider->Laravel\Cashier\{closure}()

#6 /home/forge/learningukulele.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(774): Illuminate\Container\Container->build()

#7 /home/forge/learningukulele.com/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(860): Illuminate\Container\Container->resolve()

#8 /home/forge/learningukulele.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(710): Illuminate\Foundation\Application->resolve()

#9 /home/forge/learningukulele.com/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(845): Illuminate\Container\Container->make()

#10 /home/forge/learningukulele.com/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(120): Illuminate\Foundation\Application->make()

curtsheller's avatar

@Sinnbeck It's actually part of Spark and/or Cashier). I have a message to them, I just tried here as they took a few days to even get back to me. They must be busy with Laravel 10 coming out in a week (Feb 7).

curtsheller's avatar

@Sinnbeck Crazy, file is there. And cashier.config has it as the entry.

    'invoices' => [
        'renderer' => env('CASHIER_INVOICE_RENDERER', DompdfInvoiceRenderer::class),

        'options' => [
            // Supported: 'letter', 'legal', 'A4'
            'paper' => env('CASHIER_PAPER', 'letter'),
        ],
    ],

Clear all caches and doesn't help.

kokoshneta's avatar

@curtsheller Is there a use Laravel\Cashier\Invoices\DompdfInvoiceRenderer statement at the top of your Cashier config file as well? The error message makes it look like it’s trying to find the class in the global namespace, which is not where it’s located.

If you copy-pasted the renderer config option (or the entire contents of the Cashier config file) from somewhere else, your editor wouldn’t be able to automatically add the use statement.

curtsheller's avatar

@kokoshneta Didn't copy, it's the default install and there wasn't a use statement for it.

Didn't make a different when I added it. It does seem to be getting farther along.

Now I'm getting this:

Money\Money::__construct(): Argument #1 ($amount) must be of type string|int, null given, called in /home/curtsheller/Sites/learningukulele/vendor/laravel/cashier/src/Cashier.php on line 154

And, can't even get to the Spark billing page now.

Cashier uses:

        "moneyphp/money": "^4.0",

Totally lost as to what might be going on.

curtsheller's avatar

@Sinnbeck Finally after a couple of removing and installing Cashier it seems to be working. New error gone.

Thanks for all your help. Valuable incite for things to keep an eye on.

Thanks,

Curt

Please or to participate in this conversation.