PHPackages                             labrodev/laravel-ssl-keeper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. labrodev/laravel-ssl-keeper

ActiveLibrary

labrodev/laravel-ssl-keeper
===========================

TLS certificate expiry reader for Laravel — fetches and parses the peer certificate of any host.

v1.0.0(yesterday)08↑2525%MITPHP ^8.4

Since Jul 22Compare

[ Source](https://github.com/labrodev/laravel-ssl-keeper)[ Packagist](https://packagist.org/packages/labrodev/laravel-ssl-keeper)[ Docs](https://github.com/labrodev/laravel-ssl-keeper)[ RSS](/packages/labrodev-laravel-ssl-keeper/feed)WikiDiscussions Synced today

READMEChangelogDependencies (9)Versions (2)Used By (0)

Laravel SSL Keeper
==================

[](#laravel-ssl-keeper)

TLS certificate expiry reader for Laravel — fetches and parses the peer certificate of any host. Connects over TLS, captures the presented leaf certificate, and returns its "not after" expiry date as a Carbon instance. The package stores nothing and keeps no state: one contract, one call, one date.

Installation
------------

[](#installation)

```
composer require labrodev/laravel-ssl-keeper
```

Publish the config file:

```
php artisan vendor:publish --tag=ssl-keeper-config
```

Optionally override the defaults via environment variables:

```
SSL_KEEPER_TIMEOUT=10
SSL_KEEPER_PORT=443
```

Reading a certificate's expiry date
-----------------------------------

[](#reading-a-certificates-expiry-date)

The service provider binds the `SslExpiryReader` contract to the concrete reader, so type-hint the contract and let the container inject it:

```
use Labrodev\SslKeeper\Contracts\SslExpiryReader;
use Labrodev\SslKeeper\Exceptions\SslCertificateUnparsable;
use Labrodev\SslKeeper\Exceptions\SslConnectionFailed;
use Labrodev\SslKeeper\Exceptions\SslNoCertificate;

class DomainCertificateCheck
{
    public function __construct(
        private readonly SslExpiryReader $sslExpiryReader,
    ) {}

    public function __invoke(string $host): void
    {
        try {
            $expiryDate = $this->sslExpiryReader->expiryDate($host);
        } catch (SslConnectionFailed|SslNoCertificate|SslCertificateUnparsable $exception) {
            // The message is user-presentable: "Unable to connect to example.com:443 (...)."
            report($exception);

            return;
        }

        $daysLeft = now()->diffInDays($expiryDate, false);
    }
}
```

Peer verification is deliberately disabled
------------------------------------------

[](#peer-verification-is-deliberately-disabled)

The TLS handshake runs with `verify_peer` and `verify_peer_name` turned off. That is the point of the package: it reads the expiry date even from an expired certificate, a self-signed certificate, or an otherwise broken chain — exactly the certificates a monitoring tool most needs to look at.

Consequently, this reader must never be used as a trust decision. It tells you *when* a certificate expires, not *whether* the host should be trusted.

Exceptions
----------

[](#exceptions)

- `Labrodev\SslKeeper\Exceptions\SslConnectionFailed` — the TLS connection could not be established; the message carries host, port, and the socket error.
- `Labrodev\SslKeeper\Exceptions\SslNoCertificate` — the handshake succeeded but no peer certificate was presented.
- `Labrodev\SslKeeper\Exceptions\SslCertificateUnparsable` — the certificate could not be parsed, or parsed without a usable expiry timestamp.

All three are built through `::make()` and carry the hostname in a user-presentable message.

Testing
-------

[](#testing)

The raw socket work is isolated in `Labrodev\SslKeeper\Services\TlsCertificateFetcher`, so consuming apps can fake the network entirely — bind a fake fetcher in the container and every code path above it becomes testable without touching a real host.

```
composer test      # pest
composer phpstan   # larastan, level 7
composer pint      # laravel preset
composer check     # all of the above
```

License
-------

[](#license)

MIT. See [LICENSE.md](LICENSE.md).

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance100

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/151143718?v=4)[Lashyn Petro ](/maintainers/labrodev)[@labrodev](https://github.com/labrodev)

---

Tags

laravelcertificatetlssslexpirylabrodev

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/labrodev-laravel-ssl-keeper/health.svg)

```
[![Health](https://phpackages.com/badges/labrodev-laravel-ssl-keeper/health.svg)](https://phpackages.com/packages/labrodev-laravel-ssl-keeper)
```

###  Alternatives

[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.6k](/packages/simplestats-io-laravel-client)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

813336.8k3](/packages/defstudio-telegraph)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M347](/packages/psalm-plugin-laravel)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[api-platform/laravel

API Platform support for Laravel

58174.6k17](/packages/api-platform-laravel)[masterix21/laravel-licensing

Laravel licensing package with polymorphic assignment to any model, activation keys, expirations/renewals, and seat control via LicenseUsage. Supports offline verification with public-key–signed tokens, a CLI to generate/rotate/revoke keys, and an extensible architecture via config and contracts.

1563.3k4](/packages/masterix21-laravel-licensing)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
