{"id":36978438,"url":"https://github.com/liquidweb/ssl-certificate","last_synced_at":"2026-01-13T22:47:54.959Z","repository":{"id":11197259,"uuid":"68636263","full_name":"liquidweb/ssl-certificate","owner":"liquidweb","description":"A package to validate SSL certificates","archived":false,"fork":true,"pushed_at":"2022-03-29T17:48:20.000Z","size":159,"stargazers_count":18,"open_issues_count":2,"forks_count":12,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-10-20T17:50:27.173Z","etag":null,"topics":["php","php7","ssl-certificates"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"spatie/ssl-certificate","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liquidweb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-19T18:55:37.000Z","updated_at":"2023-09-29T09:57:13.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/liquidweb/ssl-certificate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/liquidweb/ssl-certificate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liquidweb%2Fssl-certificate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liquidweb%2Fssl-certificate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liquidweb%2Fssl-certificate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liquidweb%2Fssl-certificate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liquidweb","download_url":"https://codeload.github.com/liquidweb/ssl-certificate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liquidweb%2Fssl-certificate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28403518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","php7","ssl-certificates"],"created_at":"2026-01-13T22:47:54.424Z","updated_at":"2026-01-13T22:47:54.954Z","avatar_url":"https://github.com/liquidweb.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A php package to validate SSL certificates\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/liquidweb/ssl-certificate.svg?style=flat-square)](https://packagist.org/packages/liquidweb/ssl-certificate)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Build Status](https://travis-ci.org/liquidweb/ssl-certificate.svg?branch=master)](https://travis-ci.org/liquidweb/ssl-certificate)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/liquidweb/ssl-certificate/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/liquidweb/ssl-certificate/?branch=master)\n[![Scrutinizer Code Coverage](https://scrutinizer-ci.com/g/liquidweb/ssl-certificate/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/liquidweb/ssl-certificate/?branch=master)\n[![StyleCI](https://styleci.io/repos/68636263/shield?branch=master)](https://styleci.io/repos/68636263)\n[![Total Downloads](https://img.shields.io/packagist/dt/liquidweb/ssl-certificate.svg?style=flat-square)](https://packagist.org/packages/liquidweb/ssl-certificate)\n\nThis package was inspired by, and forked from, the original [spatie/ssl-certificate](https://github.com/spatie/ssl-certificate) SSL certificate data validation and query class. Where this package differs is the scope of validation and intended goals. This package takes the SSL certificate validation a few steps further than the original class that inspired it.\n\nThis variant is able to detect if an ssl is:\n* trusted in a browser,\n* a match for the domain tested,\n* valid in a general sense,\n* providing additional chains,\n* and even if the SSL is CRL revoked.\n\nAdditionally, this package tracks and provides methods to view SSL Chain information.\n\nHere are a few examples:\n\n```php\n$certificate = SslCertificate::createForHostName('liquidweb.com'); // Basic SSL test\n$certificateWithCrl = SslCertificate::createForHostName('liquidweb.com')-\u003ewithSslCrlCheck(); // SSL test with CRL checks\n\n$certificate-\u003egetIssuer(); // returns \"GlobalSign Extended Validation CA - SHA256 - G2\"\n$certificate-\u003eisValid(); // returns true if the certificate is currently valid\n$certificate-\u003eisTrusted(); // returns true if the certificate is trusted by default\n$certificate-\u003ehasSslChain(); // returns bool of ssl chain status\n$certificate-\u003eexpirationDate(); // returns an instance of Carbon\n$certificate-\u003eexpirationDate()-\u003ediffInDays(); // returns an int\n$certificate-\u003egetSignatureAlgorithm(); // returns a string\n$certificate-\u003egetSerialNumber(); // returns a string\n\n// methods that require CRL test\n$certificateWithCrl-\u003eisRevoked(); // returns bool of revoked status, or null if no list provided\n$certificateWithCrl-\u003egetCrlRevokedTime(); // returns a Carbon instance of the CRL revocation time\n$certificateWithCrl-\u003eisValid(); // results may vary from `certificate` if the SSL is CRL revoked\n$certificateWithCrl-\u003eisTrusted(); // results may vary from `certificate` if the SSL is CRL revoked\n```\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require liquidweb/ssl-certificate\n```\n\nWhile not required it is highly suggested to install the PHP gmp extension as this will help speed up the CRL verification methods. This is due to the usage of phpseclib to work with decoding and comparing of ASN1 serials in the CRL lists.\n\n## Usage\n\nYou can create an instance of `LiquidWeb\\SslCertificate\\SslCertificate` with this named constructor:\n\n```php\n$certificate = SslCertificate::createForHostName('liquidweb.com');\n```\n\nIf the given `hostName` is invalid `LiquidWeb\\SslCertificate\\InvalidUrl` will be thrown.\n\nIf the given `hostName` is valid but there was a problem downloading the certifcate `LiquidWeb\\SslCertificate\\CouldNotDownloadCertificate` will be thrown.\n\n### Getting the issuer name\n\n```php\n$certificate-\u003egetIssuer(); // returns \"GlobalSign Extended Validation CA - SHA256 - G2\"\n```\n\n### Getting the domain name\n\nGetting a domain can be done one of two ways; you can either use `getDomain` or `getCertificateDomain`.\nThey are very similar but work slightly different in subtle ways.\n\n```php\n$certificate-\u003egetDomain(); // returns \"www.liquidweb.com\"\n```\n\nReturns the user input domain, or the primary domain name for the certificate. This dynamic style of results helps to resolve issues with CloudFlare SSLs.\nIf the certificate's primary domain is not at all similar to the input domain then this method returns the input domain.\n\n```php\n$certificate-\u003egetCertificateDomain(); // returns \"www.liquidweb.com\"\n```\n\nReturns the primary domain name for the certificate; this will consistently and ONLY return the SSLs subject CN.\n\n### Getting the certificate's signing algorithm\n\nReturns the algorithm used for signing the certificate\n\n```php\n$certificate-\u003egetSignatureAlgorithm(); // returns \"RSA-SHA256\"\n```\n\n### Getting the additional domain names\n\nA certificate can cover multiple (sub)domains. Here's how to get them.\n\n```php\n$certificate-\u003egetAdditionalDomains(); // returns [\n                                                    \"www.liquidweb.com\",\n                                                    \"www.stormondemand.com\",\n                                                    \"www.sonet7.com\",\n                                                    \"manage.stormondemand.com\",\n                                                    \"manage.liquidweb.com\",\n                                                    \"liquidweb.com\"\n                                                ]\n```\n\nA domain name return with this method can start with `*` meaning it is valid for all subdomains of that domain.\n\n### Getting the date when the certificate becomes valid\n\n```php\n$certificate-\u003evalidFromDate(); // returns an instance of Carbon\n```\n\n### Getting the expiration date\n\n```php\n$certificate-\u003eexpirationDate(); // returns an instance of Carbon\n```\n\n### Determining if the certificate is still valid\n\nReturns true if the SSL is valid for the domain, trusted by default, and is not currently expired.\n\nAn SSL is valid for the domain provided if the domain is the main subject, or a SAN.\nTrust status is determined based on how the SSL was downloaded; if it requires no cURL ssl verificaiton then it's untrused.\nExpiration status is found valid if current Date and time is between `validFromDate` and `expirationDate`.\n\n```php\n$certificate-\u003eisValid(); // returns a boolean\n```\n\nYou also use this method to determine if a given domain is covered by the certificate. Of course it'll keep checking if the current Date and time is between `validFromDate` and `expirationDate`.\n\n```php\n$certificate-\u003eisValid('liquidweb.com'); // returns true;\n$certificate-\u003eisValid('spatie.be'); // returns false;\n```\n\n### Determining if the certificate is still valid until a given date\n\nReturns true if a given date is within the certificate's expiration window. The SSL may still be invlaid for other reasons, this simply checks the date agains the `validFromDate` and `expirationDate` dates of the SSL.\n\n```php\n$certificate-\u003eisValidDate(Carbon::create('2017', '03', '30', '12', '00', '00', 'utc')); // returns a boolean\n```\n\n### Determining if the certificate is still valid until a given date and ensure it's a valid SSL\n\nReturns true if the certificate is valid and if the `expirationDate` is before the given date.\n\n```php\n$certificate-\u003eisValidUntil(Carbon::now()-\u003eaddDays(7)); // returns a boolean\n```\n\n### Determining if the certificate is expired\n\n```php\n$certificate-\u003eisExpired(); // returns a boolean if expired\n```\n\n### Determining if a certificate has been revoked\n\n```php\n$certificate = SslCertificate::createForHostName('liquidweb.com')-\u003ewithSslCrlCheck();\n$certificate-\u003eisRevoked();\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Testing\n\n``` bash\n$ composer test\n```\n\nNote: When working to test your implementation of this library you can use [BadSSL](https://badssl.com/) to simulate various SSL scenarios.\n\n## Credits\n\n- [Dan Pock](https://github.com/mallardduck) - Fork Creator \u0026 Maintainer\n- [Freek Van der Herten](https://github.com/freekmurze) - Original package creator\n- [All Contributors](../../contributors)\n\nThe helper functions and tests were copied from the [Laravel Framework](https://github.com/laravel/framework).\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliquidweb%2Fssl-certificate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliquidweb%2Fssl-certificate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliquidweb%2Fssl-certificate/lists"}