PHPackages                             indieweb/mention-client - 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. indieweb/mention-client

ActiveLibrary

indieweb/mention-client
=======================

Client library for sending webmention and pingback notifications

1.2.1(5y ago)10331.1k—10%22[6 issues](https://github.com/indieweb/mention-client-php/issues)[2 PRs](https://github.com/indieweb/mention-client-php/pulls)6Apache-2.0HTMLPHP &gt;=5.6

Since Jun 19Pushed 4y ago13 watchersCompare

[ Source](https://github.com/indieweb/mention-client-php)[ Packagist](https://packagist.org/packages/indieweb/mention-client)[ Docs](https://github.com/indieweb/mention-client-php)[ RSS](/packages/indieweb-mention-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (2)Versions (22)Used By (6)

Webmention Client
=================

[](#webmention-client)

Client library for sending [webmention](http://indiewebcamp.com/webmention) and [pingback](http://indiewebcamp.com/pingback) notifications.

[![Build Status](https://camo.githubusercontent.com/9ffee9670d0e07ccf9a9d2e5afa448934b43fe4bf48924bd8f334485167e97d4/68747470733a2f2f7472617669732d63692e6f72672f696e6469657765622f6d656e74696f6e2d636c69656e742d7068702e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/indieweb/mention-client-php)[![Packagist](https://camo.githubusercontent.com/309073b75683229a6bd2c91dc7e1984ac225b561490bf3f81cf2c7a84fc33648/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696e6469657765622f6d656e74696f6e2d636c69656e742e737667)](https://packagist.org/packages/indieweb/mention-client)

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

Given one of your source URLs, this function will find links on the page, discover the webmention and pingback endpoints for each, and send mentions for any it discovers.

```

```

The library will fetch the source URL, parse it, and look for the first h-entry, h-card or h-event. It will then attempt to send webmentions (and pingbacks) to all URLs found in the object, as either properties or inside the "content" HTML.

The library attempts to find the endpoints by doing a HEAD request to the target URL and looking at the headers, and if none are found, then it makes a GET request and searches the body of the page for the rel values.

After finding either pingback or webmention endpoints, the request is sent to each.

Alternatively, you can pass in HTML as the second parameter and the library will look for ALL absolute links in the HTML instead of fetching your post contents and looking for the microformats object.

```

```

### Discovering the Webmention endpoint

[](#discovering-the-webmention-endpoint)

Given a target URL, this function will return its webmention endpoint if found, otherwise it will return false.

```

```

### Sending a Webmention

[](#sending-a-webmention)

To send a webmention to a target URL, you can use the function below. This will first discover the webmention endpoint of the target, and if found, will then send the webmention payload to it. You can pass an additional parameter to include other properties in the payload.

```

```

If no webmention endpoint was found at the target, the function will return false. See the function below for an example of the response when the webmention is successful.

You can also check if the endpoint advertises a webmention endpoint before trying to send one:

```

```

### Sending a Pingback

[](#sending-a-pingback)

```

```

You can also check if the endpoint advertises a pingback endpoint before trying to send one:

```

```

### Sending the Webmention or Pingback directly

[](#sending-the-webmention-or-pingback-directly)

To send the actual webmention or pingback payload, you can use the static functions below. You can pass additional properties for the webmention request in an array if needed.

```

```

The response is an array containing the HTTP status code, HTTP headers, and the response body:

```
{
  "code": 202,
  "headers": {
    "Content-Type: text/plain"
  },
  "body": "Webmention is processing"
}
```

You can check if the webmention was accepted by testing if the response code is 200, 201 or 202.

```

```

The pingback function returns true or false depending on whether the pingback was successfully sent.

### Finding target URLs in a source document

[](#finding-target-urls-in-a-source-document)

If you have a rendered HTML page (or partial HTML page), you can use this function to return a list of outgoing links found on the page.

```

```

Alternately, you can pass a parsed Microformats object to the `findOutgoingLinks`function and it will search for URLs in any property as well as in the HTML of any e-content objects.

```
$client = new IndieWeb\MentionClient();
$parsed = \Mf2\parse($html, $sourceURL);
$urls = $client->findOutgoingLinks($parsed);
```

All links found will be returned an array, with duplicate URLs removed. If no links are found, it will return an empty array.

```
[
  "http://example.com/1",
  "http://example.com/2"
]
```

### Custom User Agent

[](#custom-user-agent)

You can set the user agent that this library uses when making HTTP requests.

```
IndieWeb\MentionClient::setUserAgent('Custom user agent string');
```

At that point, any HTTP request (GET, HEAD, POST) that this library makes will include the user agent header you've set.

### Debugging

[](#debugging)

If you want to collect debugging information so you can see the steps the library is doing, run `IndieWeb\MentionClient::enableDebug();` before calling any other function.

About Webmention
----------------

[](#about-webmention)

To learn more about Webmention, see [webmention.net](http://webmention.net).

The [webmention.io](http://webmention.io/) service can also act as a pingback-&gt;webmention proxy which will allow you to accept pingbacks as if they were sent as webmentions.

About Pingback
--------------

[](#about-pingback)

If you want to accept pingbacks on your site, check out [webmention.io](http://webmention.io/#use-it)which handles accepting the XMLRPC request and exposes the data via an API.

License
-------

[](#license)

Copyright 2013-2017 by Aaron Parecki and contributors

Available under the Apache 2.0 and MIT licenses.

#### Apache 2.0

[](#apache-20)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

#### MIT

[](#mit)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community31

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 80.8% 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 ~139 days

Recently: every ~438 days

Total

21

Last Release

1931d ago

Major Versions

0.4.7 → 1.0.02015-12-09

PHP version history (3 changes)0.2.0PHP &gt;=5.3

1.1.3PHP &gt;=5.4

1.2.1PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/385b302aef27e9e72ddfbf65c8b15cfce5946744fe2e541c5b415665fc2351fc?d=identicon)[aaronpk](/maintainers/aaronpk)

---

Top Contributors

[![aaronpk](https://avatars.githubusercontent.com/u/113001?v=4)](https://github.com/aaronpk "aaronpk (84 commits)")[![pfefferle](https://avatars.githubusercontent.com/u/2373?v=4)](https://github.com/pfefferle "pfefferle (7 commits)")[![HongPong](https://avatars.githubusercontent.com/u/114027?v=4)](https://github.com/HongPong "HongPong (3 commits)")[![mapkyca](https://avatars.githubusercontent.com/u/124070?v=4)](https://github.com/mapkyca "mapkyca (3 commits)")[![benwerd](https://avatars.githubusercontent.com/u/624104?v=4)](https://github.com/benwerd "benwerd (3 commits)")[![karadaisy](https://avatars.githubusercontent.com/u/950127?v=4)](https://github.com/karadaisy "karadaisy (2 commits)")[![marcusjfloyd](https://avatars.githubusercontent.com/u/7179657?v=4)](https://github.com/marcusjfloyd "marcusjfloyd (1 commits)")[![singpolyma](https://avatars.githubusercontent.com/u/12770?v=4)](https://github.com/singpolyma "singpolyma (1 commits)")

---

Tags

indiewebpingbackwebmention

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/indieweb-mention-client/health.svg)

```
[![Health](https://phpackages.com/badges/indieweb-mention-client/health.svg)](https://phpackages.com/packages/indieweb-mention-client)
```

###  Alternatives

[jkphl/micrometa

A meta parser for extracting micro information out of web documents, currently supporting Microformats 1+2, HTML Microdata, RDFa Lite 1.1 and JSON-LD

114163.8k1](/packages/jkphl-micrometa)[p3k/xray

X-Ray returns structured data from any URL

9417.4k1](/packages/p3k-xray)[indieauth/client

IndieAuth Client Library

2926.4k5](/packages/indieauth-client)[p3k/http

A simple wrapper API around the PHP curl functions

1426.7k3](/packages/p3k-http)[openpsa/midcom

Content-oriented Model-View-Controller framework for PHP

293.2k1](/packages/openpsa-midcom)

PHPackages © 2026

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