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

rhand's avatar
Level 6

Show Debug Information in Laravel Command Feedback

I am working on a command to update a Let's Encrypt certificate. It keeps on returning no proper a name found (one of the checks to make sure domain was generated before Let's Encrypt certificate is added. Here are the functions dealing with it


namespace Imagewize\SslManager\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Imagewize\SslManager\Core\DnsService;
use Imagewize\SslManager\Core\SslService;
use LogicException;

class UpdateCertificate implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    /**
     * @var int
     */
    public $tries = 3;

    /**
     * @var string
     */
    private $domain;

    /**
     * Create a new job instance.
     *
     * @param string $domain
     */
    public function __construct($domain)
    {
        $this->domain = $domain;
    }

    /**
     * Execute the job.
     *
     * @param SslService $sslService
     *
     * @param DnsService $dnsService
     * @return void
     */
    public function handle(SslService $sslService, DnsService $dnsService)
    {
        if (!$dnsService->hasProperRecord($this->domain)) {
            $this->fail(
                new LogicException(sprintf(
                    'Domain "%s" must have proper A NAME record."',
                    $this->domain
                ))
            );

            return;
        }

        $sslService->updateCertificate($this->domain);
    }
}

As it keep on returning the exception that all failed I was wondering how I can make the message more specific so I can debug things. Ideas?

0 likes
0 replies

Please or to participate in this conversation.