fullduplexuk / php-ssl-certificate
轻松检索任何主机的ssl证书
1.0.2
2021-03-04 14:19 UTC
Requires
- php: ^7.2
- ext-intl: *
- ext-json: *
- nesbot/carbon: ^1.15|^2.0
Requires (Dev)
- codeception/codeception: ^4.1
- phpunit/phpunit: ^8.0
- tightenco/collect: ^7.6
This package is not auto-updated.
Last update: 2024-09-28 06:31:19 UTC
README
此包使下载主机证书变得容易。
使用方法
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
变更日志
请参阅变更日志以获取最近更改的列表。