https://github.com/joelwmale/php-ssl-certificate
Easily retrieve the ssl certificate for any host
https://github.com/joelwmale/php-ssl-certificate
laravel php ssl-certificate
Last synced: 5 months ago
JSON representation
Easily retrieve the ssl certificate for any host
- Host: GitHub
- URL: https://github.com/joelwmale/php-ssl-certificate
- Owner: joelwmale
- License: mit
- Created: 2019-07-30T07:45:38.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2026-01-21T05:49:51.000Z (6 months ago)
- Last Synced: 2026-02-03T19:19:09.105Z (5 months ago)
- Topics: laravel, php, ssl-certificate
- Language: PHP
- Size: 113 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Easily retrieve the ssl certificate for any host
This package makes it easy to download a certificate for a host.
## Version Compatibility
| PHP Version | Package Version |
|-------------|-----------------|
| 8.3+ | 4.x |
| 8.0 - 8.2 | 3.x |
## Usage
```php
use Joelwmale\SslCertificate\Certificate;
$certificate = Certificate::forHost('joelmale.com');
```
## Installation
You can install the package via composer:
```bash
composer require joelwmale/php-ssl-certificate
```
## Available Properties & Methods
All properties are `readonly`.
```php
$certificate->issuer; // string - the issuer of the certificate
$certificate->domain; // string - the primary domain on the certificate
$certificate->additionalDomains; // array - all the additional/alt domains on the certificate
$certificate->valid; // bool - true if valid, false if not
$certificate->issued; // Carbon - when the certificate was issued
$certificate->expires; // Carbon - when the certificate expires
$certificate->expiresIn; // int - days until the certificate expires
$certificate->expired; // bool - true if the certificate is expired
$certificate->signatureAlgorithm; // string - the signature algorithm used to sign the certificate
$certificate->isSelfSigned; // bool - true if the certificate was self signed
```
### Get raw certificate as JSON
```php
$certificate->getRawCertificateFieldsAsJson();
```
### Determining if the certificate is valid at a given date
Returns true if the certificate will still be valid.
Takes a Carbon instance as the first parameter.
```php
$certificate->isValidAt(Carbon::today()->addMonth(1));
```
### Determining if certificate contains/covers a domain
Returns true if the certificate contains the domain
```php
$certificate->containsDomain('joelmale.dev');
```
## Testing
``` bash
$ composer test
```
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for a list of recent changes.