PHPackages                             league/commonmark-ext-autolink - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. league/commonmark-ext-autolink

Abandoned → [league/commonmark](/?search=league%2Fcommonmark)ArchivedCommonmark-extension[Parsing &amp; Serialization](/categories/parsing)

league/commonmark-ext-autolink
==============================

Extension for league/commonmark which autolinks URLs, emails, and @-mentions

v1.1.0(5y ago)1184.3k—0%3BSD-3-ClausePHPPHP ^7.1

Since Mar 15Pushed 5y ago4 watchersCompare

[ Source](https://github.com/thephpleague/commonmark-ext-autolink)[ Packagist](https://packagist.org/packages/league/commonmark-ext-autolink)[ Docs](https://github.com/thephpleague/commonmark-ext-autolink)[ GitHub Sponsors](https://github.com/colinodell)[ Patreon](https://www.patreon.com/colinodell)[ RSS](/packages/league-commonmark-ext-autolink/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (2)Versions (13)Used By (0)

URL and email autolinking extension for `league/commonmark`
===========================================================

[](#url-and-email-autolinking-extension-for-leaguecommonmark)

[![Latest Version on Packagist](https://camo.githubusercontent.com/65206f818888810c32b1a5b191710a64577ad576a9d20559505c542c8496c50f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c65616775652f636f6d6d6f6e6d61726b2d6578742d6175746f6c696e6b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/league/commonmark-ext-autolink)[![Software License](https://camo.githubusercontent.com/f4927c28d46f9aff0a32ba934d27da23943c7e31876f86d6362e41a56e9c66ad/687474703a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4253442d2d332d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/3f01c4666fda2b566c3924c9b5bf40ba5a81277f0d148e4c04275eabf4da4dcc/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7468657068706c65616775652f636f6d6d6f6e6d61726b2d6578742d6175746f6c696e6b2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/thephpleague/commonmark-ext-autolink)[![Coverage Status](https://camo.githubusercontent.com/139828f127f3fe232147936c7a1b20b2b08394ba021dbe28f3a1e7fb54fe0d33/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f7468657068706c65616775652f636f6d6d6f6e6d61726b2d6578742d6175746f6c696e6b2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/thephpleague/commonmark-ext-autolink/code-structure)[![Quality Score](https://camo.githubusercontent.com/764bbe7ad80c1d6eb9a340428cd8f60814f6930dbdede3256680995c7184b8cb/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7468657068706c65616775652f636f6d6d6f6e6d61726b2d6578742d6175746f6c696e6b2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/thephpleague/commonmark-ext-autolink)[![Total Downloads](https://camo.githubusercontent.com/da591d11179d6b8be247a87722c744c41fa7c76d84e43848e68f0fdcba607f1c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c65616775652f636f6d6d6f6e6d61726b2d6578742d6175746f6c696e6b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/league/commonmark-ext-autolink)

DEPRECATED
----------

[](#deprecated)

**This extension has been deprecated**. All of its functionality now exists in [`league/commonmark`](https://github.com/thephpleague/commonmark) 1.3+ under the `League\CommonMark\Extension\Autolink` namespace, so you should upgrade to that version and use that bundled extension instead of this one.

Overview
--------

[](#overview)

This extension adds [GFM-style autolinking](https://github.github.com/gfm/#autolinks-extension-) to the [`league/commonmark` Markdown parser for PHP](https://github.com/thephpleague/commonmark). It automatically link URLs and email addresses even when the CommonMark `` autolink syntax is not used.

It also provides a parser to autolink `@mentions` to Twitter, Github, or any custom service you wish, though this is disabled by default.

Install
-------

[](#install)

Via Composer

```
$ composer require league/commonmark-ext-autolink
```

Usage
-----

[](#usage)

Configure your `Environment` as usual and simply add the `AutolinkExtension` provided by this package:

```
use League\CommonMark\CommonMarkConverter;
use League\CommonMark\Environment;
use League\CommonMark\Ext\Autolink\AutolinkExtension;

// Obtain a pre-configured Environment with all the CommonMark parsers/renderers ready-to-go
$environment = Environment::createCommonMarkEnvironment();

// Add this extension
$environment->addExtension(new AutolinkExtension());

// Instantiate the converter engine and start converting some Markdown!
$converter = new CommonMarkConverter([], $environment);
echo $converter->convertToHtml('I successfully installed the https://github.com/thephpleague/commonmark-ext-autolink extension!');
```

`@mention` Autolinking
----------------------

[](#mention-autolinking)

This extension also provides functionality to automatically link "mentions" like `@colinodell` to Twitter, Github, or any other site of your choice!

For Twitter:

```
use League\CommonMark\Environment;
use League\CommonMark\Ext\Autolink\InlineMentionParser;

$environment = Environment::createCommonMarkEnvironment();
$environment->addInlineParser(InlineMentionParser::createTwitterHandleParser());

// TODO: Instantiate your converter and convert some Markdown
```

For GitHub:

```
use League\CommonMark\Environment;
use League\CommonMark\Ext\Autolink\InlineMentionParser;

$environment = Environment::createCommonMarkEnvironment();
$environment->addInlineParser(InlineMentionParser::createGithubHandleParser());

// TODO: Instantiate your converter and convert some Markdown
```

Or configure your own custom one:

```
use League\CommonMark\Environment;
use League\CommonMark\Ext\Autolink\InlineMentionParser;

$environment = Environment::createCommonMarkEnvironment();
$environment->addInlineParser(new InlineMentionParser('https://www.example.com/users/%s/profile'));

// TODO: Instantiate your converter and convert some Markdown
```

When creating your own, you can provide two parameters to the constructor:

- A URL template where `%s` is replaced with the username (required)
- A regular expression to parse and validate the username (optional - defaults to `'/^[A-Za-z0-9_]+(?!\w)/'`)

Changelog
---------

[](#changelog)

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

Testing
-------

[](#testing)

```
$ composer test
```

Security
--------

[](#security)

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

Credits
-------

[](#credits)

- [Colin O'Dell](https://github.com/colinodell)
- [All Contributors](../../contributors)

License
-------

[](#license)

This library is licensed under the BSD-3 license. See the [License File](LICENSE) for more information.

###  Health Score

37

—

LowBetter than 84% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 87.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 ~38 days

Recently: every ~73 days

Total

11

Last Release

2177d ago

Major Versions

v0.3.0 → v1.0.0-beta12019-05-27

v0.3.1 → v1.0.0-beta32019-06-17

PHP version history (3 changes)v0.1.0PHP &gt;=5.6

v0.2.0PHP ^5.6||^7.0

v0.3.0PHP ^7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/4325b62a6ad366c731c3120595d861469be50f9da88df3ea99752c30ff98c179?d=identicon)[colinodell](/maintainers/colinodell)

---

Top Contributors

[![colinodell](https://avatars.githubusercontent.com/u/202034?v=4)](https://github.com/colinodell "colinodell (41 commits)")[![glensc](https://avatars.githubusercontent.com/u/199095?v=4)](https://github.com/glensc "glensc (5 commits)")[![svenluijten](https://avatars.githubusercontent.com/u/11269635?v=4)](https://github.com/svenluijten "svenluijten (1 commits)")

---

Tags

autolinkcommonmarkcommonmark-extensiongfmgithub-flavored-markdownmarkdownphpmarkdowngithubgfmcommonmarktwitterextensionautolink

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/league-commonmark-ext-autolink/health.svg)

```
[![Health](https://phpackages.com/badges/league-commonmark-ext-autolink/health.svg)](https://phpackages.com/packages/league-commonmark-ext-autolink)
```

###  Alternatives

[league/commonmark

Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)

2.9k393.7M556](/packages/league-commonmark)[zoon/commonmark-ext-youtube-iframe

Extension for league/commonmark to replace youtube link with iframe

12273.1k1](/packages/zoon-commonmark-ext-youtube-iframe)

PHPackages © 2026

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