PHPackages                             stayallive/tlsa - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. stayallive/tlsa

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

stayallive/tlsa
===============

Generate TLSA records in PHP.

v2.1.0(4mo ago)32.4k↓50%1MITPHPPHP ^8.0CI passing

Since Sep 15Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/stayallive/tlsa-php)[ Packagist](https://packagist.org/packages/stayallive/tlsa)[ Docs](https://github.com/stayallive/tlsa-php)[ GitHub Sponsors](https://github.com/stayallive)[ RSS](/packages/stayallive-tlsa/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

TSLA RR builder for PHP
=======================

[](#tsla-rr-builder-for-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7977ea25b0d1e129ef26a4fbed56f9fafee12339586c3b8e256e79ba7de8c8d1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73746179616c6c6976652f746c73612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stayallive/tlsa)[![Total Downloads](https://camo.githubusercontent.com/bb67393e50ec463bdd9db6f4c9af1afed4b631d7189b846021c019402bc18b24/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73746179616c6c6976652f746c73612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stayallive/tlsa)

This package contains a class that can generate TLSA resource records.

```
$tlsa = new Stayallive\TLSA\Builder('alexbouma.me');

$tlsa->forCertificate($pemEncodedCertificate);

$tlsa->getRecord(); // returns the full DNS record

$tlsa->getRecordContents(); // returns the DNS record contents only
```

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

[](#installation)

You can install the package via composer:

```
composer require stayallive/tlsa
```

Usage
-----

[](#usage)

The class can generate a TLSA resource record for all certificate usages, selectors and matching types.

For more information check out the Wikipedia entry: [https://en.wikipedia.org/wiki/DNS-based\_Authentication\_of\_Named\_Entities#RR\_data\_fields](https://en.wikipedia.org/wiki/DNS-based_Authentication_of_Named_Entities#RR_data_fields)

```
use Stayallive\TLSA;

$tlsa = new TLSA\Builder('alexbouma.me', 25, 'udp'); // Builder for the alexbouma.me domain, port 25 and the UDP protocol

$tlsa->forCertificate($pemEncodedCertificate);
$tlsa->forPublicKey($pemEncodedPublicKey);

$tlsa->certificateUsage(TLSA\Builder::CERTIFICATE_USAGE_DOMAIN_ISSUED_CERTIFICATE); // Set the certificate usage to `3` (default)

$tlsa->selector(TLSA\Builder::SELECTOR_PUBLIC_KEY); // Set the selector to `1` (default)

$tlsa->matchingType(TLSA\Builder::MATCHING_TYPE_SHA256); // Set the matching type to `1` (default)

$dns->getRecord(); // returns the full DNS record
$dns->getRecordContents(); // returns the DNS record contents
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Alex Bouma](https://github.com/stayallive)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance77

Regular maintenance activity

Popularity24

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 84.2% of commits — single point of failure

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

Every ~1337 days

Total

3

Last Release

127d ago

Major Versions

v1.0.0 → v2.0.02022-01-24

PHP version history (2 changes)v1.0.0PHP ^7.1

v2.0.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1090754?v=4)[Alex Bouma](/maintainers/stayallive)[@stayallive](https://github.com/stayallive)

---

Top Contributors

[![stayallive](https://avatars.githubusercontent.com/u/1090754?v=4)](https://github.com/stayallive "stayallive (16 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")

---

Tags

dnsphptlsadnstlsa

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/stayallive-tlsa/health.svg)

```
[![Health](https://phpackages.com/badges/stayallive-tlsa/health.svg)](https://phpackages.com/packages/stayallive-tlsa)
```

###  Alternatives

[daverandom/libdns

DNS protocol implementation written in pure PHP

16339.1M9](/packages/daverandom-libdns)[spatie/dns

Retrieve DNS records

6082.3M17](/packages/spatie-dns)[orrison/cumulus

Import DNS records from Laravel Vapor into Cloudflare

3817.1k](/packages/orrison-cumulus)[mesour/dns-checker

DNS checker written in PHP for check and compare real DNS records for domain.

2024.6k](/packages/mesour-dns-checker)[astrotomic/laravel-dns

327.4k](/packages/astrotomic-laravel-dns)

PHPackages © 2026

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