rawilk / laravel-printing

Direct printing for Laravel apps.
https://randallwilk.dev/docs/laravel-printing
MIT License
438 stars 71 forks source link

`Error Interface "Http\Client\HttpClient" not found.` with CUPS driver #81

Open ARMBouhali opened 7 months ago

ARMBouhali commented 7 months ago

Laravel Printing Version

dev-main

Laravel Version

^9.0

Print Driver

cups

Bug description

When I try to run any laravel printing basic operation like Printing::printers() with the cups driver

I get the following (using tinker --verbose):

   Error  Interface "Http\Client\HttpClient" not found.

() at vendor/rawilk/laravel-printing/src/Drivers/Cups/Support/Client.php:27
 include() at vendor/composer/ClassLoader.php:571
 Composer\Autoload\includeFile() at vendor/composer/ClassLoader.php:428
 Composer\Autoload\ClassLoader->loadClass() at vendor/rawilk/laravel-printing/src/Drivers/Cups/Cups.php:37
 Rawilk\Printing\Drivers\Cups\Cups->__construct() at vendor/rawilk/laravel-printing/src/Factory.php:42
 Rawilk\Printing\Factory->createCupsDriver() at vendor/rawilk/laravel-printing/src/Factory.php:95
 Rawilk\Printing\Factory->resolve() at vendor/rawilk/laravel-printing/src/Factory.php:62
 Rawilk\Printing\Factory->get() at vendor/rawilk/laravel-printing/src/Factory.php:30
 Rawilk\Printing\Factory->driver() at vendor/rawilk/laravel-printing/src/PrintingServiceProvider.php:30
 Rawilk\Printing\PrintingServiceProvider->Rawilk\Printing\{closure}() at vendor/laravel/framework/src/Illuminate/Container/Container.php:885
 Illuminate\Container\Container->build() at vendor/laravel/framework/src/Illuminate/Container/Container.php:770
 Illuminate\Container\Container->resolve() at vendor/laravel/framework/src/Illuminate/Foundation/Application.php:856
 Illuminate\Foundation\Application->resolve() at vendor/laravel/framework/src/Illuminate/Container/Container.php:706
 Illuminate\Container\Container->make() at vendor/laravel/framework/src/Illuminate/Foundation/Application.php:841
 Illuminate\Foundation\Application->make() at vendor/laravel/framework/src/Illuminate/Container/Container.php:1431
 Illuminate\Container\Container->offsetGet() at vendor/rawilk/laravel-printing/src/PrintingServiceProvider.php:34
 Rawilk\Printing\PrintingServiceProvider->Rawilk\Printing\{closure}() at vendor/laravel/framework/src/Illuminate/Container/Container.php:885
 Illuminate\Container\Container->build() at vendor/laravel/framework/src/Illuminate/Container/Container.php:770
 Illuminate\Container\Container->resolve() at vendor/laravel/framework/src/Illuminate/Foundation/Application.php:856
 Illuminate\Foundation\Application->resolve() at vendor/laravel/framework/src/Illuminate/Container/Container.php:706
 Illuminate\Container\Container->make() at vendor/laravel/framework/src/Illuminate/Foundation/Application.php:841
 Illuminate\Foundation\Application->make() at vendor/laravel/framework/src/Illuminate/Container/Container.php:1431
 Illuminate\Container\Container->offsetGet() at vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:222
 Illuminate\Support\Facades\Facade::resolveFacadeInstance() at vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:193
 Illuminate\Support\Facades\Facade::getFacadeRoot() at vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:332
 Illuminate\Support\Facades\Facade::__callStatic() at eval()'d code:1
 eval() at vendor/psy/psysh/src/ExecutionLoopClosure.php:53
 Psy\{closure}() at vendor/psy/psysh/src/ExecutionClosure.php:89
 Psy\ExecutionClosure->execute() at vendor/psy/psysh/src/Shell.php:395
 Psy\Shell->doInteractiveRun() at vendor/psy/psysh/src/Shell.php:366
 Psy\Shell->doRun() at vendor/symfony/console/Application.php:168
 Symfony\Component\Console\Application->run() at vendor/psy/psysh/src/Shell.php:341
 Psy\Shell->run() at vendor/laravel/tinker/src/Console/TinkerCommand.php:85
 Laravel\Tinker\Console\TinkerCommand->handle() at vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
 Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() at vendor/laravel/framework/src/Illuminate/Container/Util.php:41
 Illuminate\Container\Util::unwrapIfClosure() at vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
 Illuminate\Container\BoundMethod::callBoundMethod() at vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37
 Illuminate\Container\BoundMethod::call() at vendor/laravel/framework/src/Illuminate/Container/Container.php:661
 Illuminate\Container\Container->call() at vendor/laravel/framework/src/Illuminate/Console/Command.php:183
 Illuminate\Console\Command->execute() at vendor/symfony/console/Command/Command.php:312
 Symfony\Component\Console\Command\Command->run() at vendor/laravel/framework/src/Illuminate/Console/Command.php:153
 Illuminate\Console\Command->run() at vendor/symfony/console/Application.php:1022
 Symfony\Component\Console\Application->doRunCommand() at vendor/symfony/console/Application.php:314
 Symfony\Component\Console\Application->doRun() at vendor/symfony/console/Application.php:168
 Symfony\Component\Console\Application->run() at vendor/laravel/framework/src/Illuminate/Console/Application.php:102
 Illuminate\Console\Application->run() at vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:155
 Illuminate\Foundation\Console\Kernel->handle() at artisan:37

I think the driver's code is outdated, maybe it's less used than PrintNode ? FYI @rawilk

Steps to reproduce

Relevant log output

No response

rawilk commented 6 months ago

I think this is related to issue #74. I personally don't use CUPS so I haven't run into this issue myself, except during my automated tests for this package. In the future I'd definitely like to possibly research how the cups dependency does things and then write that directly into this package. That approach would be ideal since we could then just eliminate that 3rd party dependency all-together.

I'm not sure when, or if I'll get a chance to do that, so PR's from anyone on that would be greatly appreciated.