joelwmale/php-ssl-certificate

轻松获取任何主机的ssl证书

2.0.2 2021-09-11 03:50 UTC

README

Build Status Total Downloads Latest Stable Version License

此包使下载主机的证书变得简单。

用法

use Joelwmale\SslCertificate\Certificate;

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

安装

您可以通过composer安装此包

composer require joelwmale/php-ssl-certificate

可用的属性和方法

/** @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

获取原始证书作为JSON

$certificate->getRawCertificateFieldsAsJson();

确定证书在给定日期是否有效

如果证书仍然有效则返回true。第一个参数是Carbon实例。

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

确定证书是否包含/转换域名

如果证书包含域名则返回true

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

测试

$ composer test

变更日志

请参阅 CHANGELOG 了解最近更改的列表。