PHP code example of joelwmale / php-ssl-certificate

1. Go to this page and download the library: Download joelwmale/php-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/ */

    

joelwmale / php-ssl-certificate example snippets


use Joelwmale\SslCertificate\Certificate;

$certificate = Certificate::forHost('joelmale.com');

/** @var string */
$certificate->issuer; // returns the issuer of the certificate

/** @var string */
$certificate->domain; // returns the primary domain on the certificate

/** @var array */
$certificate->additionalDomains; // returns all the additional/alt domains on the certificate

/** @var bool */
$certificate->isValid; // returns true if valid, false if not

/** @var Carbon */
$certificate->issued; // returns a carbon instance of when the certificate was issued

/** @var Carbon */
$certificate->expires; // returns a carbon instance of when the certificate expires

/** @var int */
$certificate->expiresIn; // returns the amount of days until the certificate expires

/** @var bool */
$certificate->expired; // returns true if the certificate is expired, false if not

/** @var string */
$certificate->signatureAlgorithm; // returns the signature algorithm used to sign the certificate

/** @var bool */
$certificate->isSelfSigned; // returns true if the certificate was self signed

$certificate->getRawCertificateFieldsAsJson();

$certificate->isValidAt(Carbon::today()->addMonth(1));

$certificate->containsDomain('joelmale.dev');
bash
composer