Great stuff again by Freek Murze from Spatie: A PHP class to easily check the validity of an SSL Certificate. Easily? Yes, easily:
$certificate = SslCertificate::createForHostName('spatie.be');
$certificate->getIssuer(); // returns "Let's Encrypt Authority X3"
$certificate->isValid(); // returns true if the certificate is currently valid
$certificate->isValid(domain.com); // returns true if the certificate is currently valid for the given `domain.com`
$certificate->expirationDate(); // returns an instance of Carbon
$certificate->expirationDate()->diffInDays(); // returns an int
spatie/ssl-certificate
(GitHub) →
Validating SSL certificates with PHP →