PHP code example of liquidweb / ssl-certificate

1. Go to this page and download the library: Download liquidweb/ssl-certificate library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

liquidweb / ssl-certificate example snippets


$certificate = SslCertificate::createForHostName('liquidweb.com'); // Basic SSL test
$certificateWithCrl = SslCertificate::createForHostName('liquidweb.com')->withSslCrlCheck(); // SSL test with CRL checks

$certificate->getIssuer(); // returns "GlobalSign Extended Validation CA - SHA256 - G2"
$certificate->isValid(); // returns true if the certificate is currently valid
$certificate->isTrusted(); // returns true if the certificate is trusted by default
$certificate->hasSslChain(); // returns bool of ssl chain status
$certificate->expirationDate(); // returns an instance of Carbon
$certificate->expirationDate()->diffInDays(); // returns an int
$certificate->getSignatureAlgorithm(); // returns a string
$certificate->getSerialNumber(); // returns a string

// methods that 

$certificate = SslCertificate::createForHostName('liquidweb.com');

$certificate->getIssuer(); // returns "GlobalSign Extended Validation CA - SHA256 - G2"

$certificate->getDomain(); // returns "www.liquidweb.com"

$certificate->getCertificateDomain(); // returns "www.liquidweb.com"

$certificate->getSignatureAlgorithm(); // returns "RSA-SHA256"

$certificate->getAdditionalDomains(); // returns [
                                                    "www.liquidweb.com",
                                                    "www.stormondemand.com",
                                                    "www.sonet7.com",
                                                    "manage.stormondemand.com",
                                                    "manage.liquidweb.com",
                                                    "liquidweb.com"
                                                ]

$certificate->validFromDate(); // returns an instance of Carbon

$certificate->expirationDate(); // returns an instance of Carbon

$certificate->isValid(); // returns a boolean

$certificate->isValid('liquidweb.com'); // returns true;
$certificate->isValid('spatie.be'); // returns false;

$certificate->isValidDate(Carbon::create('2017', '03', '30', '12', '00', '00', 'utc')); // returns a boolean

$certificate->isValidUntil(Carbon::now()->addDays(7)); // returns a boolean

$certificate->isExpired(); // returns a boolean if expired

$certificate = SslCertificate::createForHostName('liquidweb.com')->withSslCrlCheck();
$certificate->isRevoked();