PHPackages                             misd/linkify - 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. misd/linkify

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

misd/linkify
============

Converts URLs and email addresses in text into HTML links

v1.1.4(8y ago)1122.9M—0.6%17[7 issues](https://github.com/misd-service-development/php-linkify/issues)[6 PRs](https://github.com/misd-service-development/php-linkify/pulls)9MITPHPPHP &gt;=5.3.0

Since Oct 8Pushed 6y ago6 watchersCompare

[ Source](https://github.com/misd-service-development/php-linkify)[ Packagist](https://packagist.org/packages/misd/linkify)[ Docs](https://github.com/misd-service-development/php-linkify)[ RSS](/packages/misd-linkify/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (9)

Linkify
=======

[](#linkify)

[![Build Status](https://camo.githubusercontent.com/3167b1e560b4b46f17c5f0165ebdeb892e463e233c04b385b450a9adca9c3899/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6d6973642d736572766963652d646576656c6f706d656e742f7068702d6c696e6b6966792e706e67)](http://travis-ci.org/misd-service-development/php-linkify)

Converts URLs and email addresses into clickable links. It works on both snippets of HTML (or plain text) and complete HTML pages.

There are many regex variations shared on the internet for performing this task, but few are robust. Linkify contains a large number of unit tests to counter this.

It does not cover every possible valid-yet-never-used URLs and email addresses in order to handle 'real world' usage (eg no 'gopher://'). This means, for example, that it copes better with punctuation errors.

Authors
-------

[](#authors)

- Chris Wilkinson

It uses regex based on John Gruber's [Improved Liberal, Accurate Regex Pattern for Matching URLs](http://daringfireball.net/2010/07/improved_regex_for_matching_urls).

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

[](#installation)

`composer require misd/linkify`

Usage
-----

[](#usage)

```
$linkify = new \Misd\Linkify\Linkify();
$text = 'This is my text containing a link to www.example.com.';

echo $linkify->process($text);
```

Will output:

```
This is my text containing a link to www.example.com.
```

### Options

[](#options)

Options set on the constructor will be applied to all links. Alternatively you can place the options on a method call. The latter will override the former.

```
$linkify = new \Misd\Linkify\Linkify(array('attr' => array('class' => 'foo')));
$text = 'This is my text containing a link to www.example.com.';

echo $linkify->process($text);
```

Will output:

```
This is my text containing a link to www.example.com.
```

Whereas:

```
$linkify = new \Misd\Linkify\Linkify(array('attr' => array('class' => 'foo')));
$text = 'This is my text containing a link to www.example.com.';

echo $linkify->process($text, array('attr' => array('class' => 'bar')));
```

Will output:

```
This is my text containing a link to www.example.com.
```

Available options are:

#### `attr`

[](#attr)

An associative array of HTML attributes to add to the link. For example:

```
array('attr' => array('class' => 'foo', 'style' => 'font-weight: bold; color: red;')
```

#### `callback`

[](#callback)

A closure to call with each url match. The closure will be called for each URL found with three parameters: the url, the caption and a boolean `isEmail` (if `$isEmail` is true, then `$url` is equals to `$caption`.

If the callback return a non-null value, this value replace the link in the resulting text. If null is returned, the usual `CAPTION` is used.

```
$linkify = new \Misd\Linkify\Linkify(array('callback' => function($url, $caption, $isEmail) {
    return '' . $caption . '';
}));
echo $linkify->process('This link will be converted to bold: www.example.com.'));
```

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity58

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 89.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 ~354 days

Recently: every ~436 days

Total

6

Last Release

3196d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e6aaeba393e9038b5a5a916e5f4e32ffb349436e3be2027be4828f486bc8c9d?d=identicon)[thewilkybarkid](/maintainers/thewilkybarkid)

---

Top Contributors

[![thewilkybarkid](https://avatars.githubusercontent.com/u/1784740?v=4)](https://github.com/thewilkybarkid "thewilkybarkid (66 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (2 commits)")[![edea](https://avatars.githubusercontent.com/u/1705717?v=4)](https://github.com/edea "edea (1 commits)")[![arthurdarcet](https://avatars.githubusercontent.com/u/973454?v=4)](https://github.com/arthurdarcet "arthurdarcet (1 commits)")[![KaneCohen](https://avatars.githubusercontent.com/u/578455?v=4)](https://github.com/KaneCohen "KaneCohen (1 commits)")[![miclf](https://avatars.githubusercontent.com/u/3188746?v=4)](https://github.com/miclf "miclf (1 commits)")[![jarofgreen](https://avatars.githubusercontent.com/u/85656?v=4)](https://github.com/jarofgreen "jarofgreen (1 commits)")[![bartgloudemans](https://avatars.githubusercontent.com/u/411451?v=4)](https://github.com/bartgloudemans "bartgloudemans (1 commits)")

---

Tags

urllinkconvertemail address

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/misd-linkify/health.svg)

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

###  Alternatives

[jbroadway/urlify

A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs.

6737.4M62](/packages/jbroadway-urlify)[spatie/url

Parse, build and manipulate URL's

73914.3M97](/packages/spatie-url)[league/uri-components

URI components manipulation library

31932.3M67](/packages/league-uri-components)[nahid/linkify

Converts URLs and email addresses in text into HTML links its extended from Misd\\Linify its also support laravel 5

11136.0k1](/packages/nahid-linkify)[sabre/uri

Functions for making sense out of URIs.

29335.2M40](/packages/sabre-uri)[spomky-labs/base64url

Base 64 URL Safe Encoding/Decoding PHP Library

15439.5M49](/packages/spomky-labs-base64url)

PHPackages © 2026

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