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

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

nahid/linkify
=============

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

1.0.0(10y ago)11136.0k↓13.7%5[1 issues](https://github.com/nahid/linkify/issues)1MITPHPPHP &gt;=5.3.0

Since Apr 16Pushed 9y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (1)Versions (2)Used By (1)

Linkify
=======

[](#linkify)

This a Linkify Laravel 5 supported package. Its 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)

- Main Author : Chris Wilkinson
- Laravel Support : Nahid Bin Azhar

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)

1. Add Linkify to your dependencies:

    ```
    // composer.json

    {
       // ...
       "require": {
           // ...
           "nahid/linkify": "1.1.*"
       }
    }

    ```
2. Use Composer to download and install Linkify:

    ```
    $ php composer.phar update Nahid/linkify

    ```
3. open `config/app.php` and in providers array add this line

    ```
    Nahid\Linkify\LinkifyServiceProvider::class,
    ```

    and in aliases array add this line too

    ```
    'Linkify' => Nahid\Linkify\Facades\Linkify::class,
    ```
4. Open terminal and goto your project and run this command

    ```
    composer dump-autoload

    ```

Usage
-----

[](#usage)

```
    $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 \Nahid\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 \Nahid\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 \Nahid\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

35

—

LowBetter than 80% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community12

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

3684d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3167309?v=4)[Nahid Bin Azhar](/maintainers/nahid)[@nahid](https://github.com/nahid)

---

Top Contributors

[![nahid](https://avatars.githubusercontent.com/u/3167309?v=4)](https://github.com/nahid "nahid (8 commits)")

---

Tags

urllaravellinkconvertlaravel 5email address

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[misd/linkify

Converts URLs and email addresses in text into HTML links

1122.9M10](/packages/misd-linkify)[jbroadway/urlify

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

6737.4M62](/packages/jbroadway-urlify)[shivella/laravel-bitly

Laravel package for generating bitly url

75789.0k1](/packages/shivella-laravel-bitly)[laracrafts/laravel-url-shortener

Powerful URL shortening tools in Laravel

97110.7k](/packages/laracrafts-laravel-url-shortener)[mad-web/nova-horizon-link

Smart Link for Laravel Nova to Horizon Dashboard.

24201.4k](/packages/mad-web-nova-horizon-link)[burnbright/silverstripe-externalurlfield

Provides SilverStripe with a DBField and FormField for handling external URLs.

109.6k1](/packages/burnbright-silverstripe-externalurlfield)

PHPackages © 2026

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