PHPackages                             zegnat/webmention-endpoint-discovery - 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. zegnat/webmention-endpoint-discovery

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

zegnat/webmention-endpoint-discovery
====================================

A straight forward implementation of webmention endpoint discovery.

v1.0(7y ago)2110BSDPHPPHP ^7.0

Since Aug 18Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Zegnat/php-webmention-endpoint-discovery)[ Packagist](https://packagist.org/packages/zegnat/webmention-endpoint-discovery)[ Docs](https://github.com/Zegnat/php-webmention-endpoint-discovery)[ RSS](/packages/zegnat-webmention-endpoint-discovery/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)Dependencies (11)Versions (3)Used By (0)

Webmention Endpoint Discovery
=============================

[](#webmention-endpoint-discovery)

Mostly a thought experiment to see what exactly is required to do [Webmention endpoints discovery](https://webmention.net/draft/#sender-discovers-receiver-webmention-endpoint). You can use this implementation on its own, though it will probably net you better results to tightly integrate the code within the rest of your application.

Under the licence of this project you should feel free to copy any parts of it that you want to take for inspiration! Not even attribution is required – even when appreciated.

Install
-------

[](#install)

Via Composer

```
$ composer require zegnat/webmention-endpoint-discovery
```

Usage
-----

[](#usage)

```
$discoverer = new Zegnat\Webmention\EndpointDiscovery($httpClient, $requestFactory);
echo $discoverer->discover('https://webmention.rocks/test/1');
// https://webmention.rocks/test/1/webmention\?head=true
```

- `$httpClient` must be an implementation of `HttpClient` as defined by [HTTPlug](http://httplug.io/). This will (hopefully soon) be replaced with PSR-18.
- `$requestFactory` must be an implementation of `RequestFactoryInterface` as defined by [PHP-FIG](https://www.php-fig.org/) as [PSR-17](https://www.php-fig.org/psr/psr-17/).

### Secure Endpoints

[](#secure-endpoints)

***NOTE:*** This feature is very much experimental. Please consult the code before deciding to use it.

There might be some weird issues triggered by having Webmention senders post mentions to things on their local machines. The Webmention specification calls on senders to [avoid sending Webmentions to localhost](https://webmention.net/draft/#avoid-sending-webmentions-to-localhost). This library enables that.

`EndpointDiscovery::secureDiscover` will return `null` not only when no endpoint could be found, but also when the found endpoint’s host’s DNS resolves to an IP address in the private or reserved range. When all the IP addresses found are deemed to be OK, the method will return an array as follows:

```
$discoverer = new Zegnat\Webmention\EndpointDiscovery($httpClient, $requestFactory);
var_export($discoverer->secureDiscover('https://webmention.rocks/test/1'));
// array (
//   'url' => 'https://webmention.rocks/test/1/webmention?head=true',
//   'host' => 'webmention.rocks',
//   'ips' =>
//   array (
//     0 => '173.230.155.197',
//   ),
// )
```

It is recommended that the Webmention sender uses this information for posting the mention. Use one of the checked IP addresses to post to (instead of the domain, which might redo the DNS lookup) with the host in a `Host` HTTP header.

Testing
-------

[](#testing)

For quick testing without logging, coverage reports, or live calls to [Webmention Rocks!](https://webmention.rocks/):

```
$ composer test -- --no-logging --no-coverage --exclude-group internet
```

Else:

```
$ composer test
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2872d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/490579?v=4)[Martijn van der Ven](/maintainers/Zegnat)[@Zegnat](https://github.com/Zegnat)

---

Top Contributors

[![Zegnat](https://avatars.githubusercontent.com/u/490579?v=4)](https://github.com/Zegnat "Zegnat (12 commits)")

---

Tags

indiewebwebmentionindiewebwebmention

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/zegnat-webmention-endpoint-discovery/health.svg)

```
[![Health](https://phpackages.com/badges/zegnat-webmention-endpoint-discovery/health.svg)](https://phpackages.com/packages/zegnat-webmention-endpoint-discovery)
```

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

7.9k1.1B3.8k](/packages/guzzlehttp-psr7)[cakephp/cakephp

The CakePHP framework

8.8k19.1M1.7k](/packages/cakephp-cakephp)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[florianv/exchanger

PHP exchange rate provider layer for currency conversion: 30 services, chain fallback, and caching.

1864.9M20](/packages/florianv-exchanger)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28146.3k](/packages/phpro-http-tools)

PHPackages © 2026

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