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

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

taylornetwork/linkify
=====================

A package to linkify text

1.0.0(7y ago)128MITPHPPHP &gt;=7.0

Since Oct 23Pushed 6y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

Linkify
=======

[](#linkify)

A package to convert all links in a string to Markdown, HTML, or your own custom format.

Painlessly Convert:

```
'This text has a link https://github.com/taylornetwork/linkify and also another one https://google.com'
```

To:

```
'This text has a link [github.com](https://github.com/taylornetwork/linkify) and also another one [google.com](https://google.com)'

// OR

'This text has a link github.com and also another one google.com'
```

Install
-------

[](#install)

Via Composer

```
$ composer require taylornetwork/linkify
```

Usage
-----

[](#usage)

See [Config Options](#config)

### Linkify Class

[](#linkify-class)

**Basic Usage**

```
use TaylorNetwork\Linkify\Linkify;

$text = 'This has a link. https://google.com';

$linkify = new Linkify;
$linkify->parse($text);
```

Returns

```
'This has a link. [google.com](https://google.com)'

```

**Basic Usage - Static Call**

```
use TaylorNetwork\Linkify\Linkify;

$text = 'This has a link. https://google.com';

Linkify::instance()->parse($text);
```

Returns

```
'This has a link. [google.com](https://google.com)'

```

**Override Config**

```
use TaylorNetwork\Linkify\Linkify;

$text = 'This has a link. https://google.com';

$linkify = new Linkify;
$linkify->setConfig('convertTo', Linkify::ConvertHTML);
$linkify->parse($text);
```

Returns

```
'This has a link. google.com'

```

**Override Config - Static, One Line**

```
use TaylorNetwork\Linkify\Linkify;

$text = 'This has a link. https://google.com';

Linkify::instance()->setConfig('convertTo', Linkify::ConvertHTML)->parse($text);
```

Returns

```
'This has a link. google.com'

```

---

### Makes Links Trait

[](#makes-links-trait)

The `MakesLinks` trait will allow you to access the parser with a `linkify($text)` method on your class.

**Basic Usage**

```
use TaylorNetwork\Linkify\MakesLinks;

class DummyClass
{
	use MakesLinks;

	protected $text = 'This has a link. https://google.com';

	public function getParsedText()
	{
		return $this->linkify($this->text);
	}
}
```

`getParsedText()` returns

```
'This has a link. [google.com](https://google.com)'

```

**Override Config**

```
use TaylorNetwork\Linkify\MakesLinks;
use TaylorNetwork\Linkify\Linkify;

class DummyClass
{
	use MakesLinks;

	protected $text = 'This has a link. https://google.com';

	public function getParsedText()
	{
		return $this->linkify($this->text);
	}

	public function linkifyConfig(&$linkify)
	{
		$linkify->setConfig('convertTo', Linkify::ConvertHTML);
		$linkify->setConfig('linkAttributes', [
			'class' => 'btn-link'
		]);
	}
}
```

`getParsedText()` returns

```
'This has a link. google.com'

```

**With Custom Format**

```
use TaylorNetwork\Linkify\MakesLinks;
use TaylorNetwork\Linkify\Linkify;

class DummyClass
{
	use MakesLinks;

	protected $text = 'This has a link. https://google.com';

	public function getParsedText()
	{
		return $this->linkify($this->text);
	}

	public function linkifyConfig(&$linkify)
	{
		$linkify->setConfig('convertTo', Linkify::ConvertCustom);
	}

	public function linkifyCustomParse(string $caption, string $url)
	{
		return '=>' . $caption . 'google.com [
	'target' => '_blank',
	'class' => 'btn-link',
],
```

Would generate links:

```
$caption

```

Where `$caption` and `$url` would be replaced automatically.

*Note: attributes are added in the order from the array and this only runs if using the `Linkify::ConvertHTML` setting in `convertTo`*

---

#### Only format non-formatted links

[](#only-format-non-formatted-links)

The `checkForExistingFormatting` setting should be set to `true` if you want to only convert links that don't have existing formatting (default).

For example:

```
// Link is already formatted, by user, or another package, etc.
$text = 'Link: [link](https://google.com)';

Linkify::instance()->parse($text);

// Returns

// If 'checkForExistingFormatting' is true
'Link: [link](https://google.com)'

// If 'checkForExistingFormatting' is false
'Link: [link]([google.com](https://google.com))'
```

---

#### Custom Formatting

[](#custom-formatting)

**You can define a custom formatter in the config file, but prefer that you use the `MakeLinks` trait.**

[See Makes Links Trait](#makes-links-trait)

```
'customCallback' => function ($caption, $url) {
	return '{' . $caption . '}#' . $url . '#';
},
```

If `'convertTo' => Linkify::ConvertCustom` the `$caption` and `$url` will be passed to the callback.

This would return: `'{google.com}#https://google.com#'`

License
-------

[](#license)

MIT

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

Every ~198 days

Total

2

Last Release

2560d ago

Major Versions

0.1 → 1.0.02019-05-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/83340094473f0bf5b2cf062bf394df221a52a30aa0e21cd0a77302977d6393ce?d=identicon)[samueljtaylor](/maintainers/samueljtaylor)

---

Top Contributors

[![samyrataylor](https://avatars.githubusercontent.com/u/15961687?v=4)](https://github.com/samyrataylor "samyrataylor (10 commits)")

---

Tags

convert-linkshtmllaravellaravel-packagelinkifymarkdownphpphp7user-input

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-sitemap

Create and generate sitemaps with ease

2.6k14.6M107](/packages/spatie-laravel-sitemap)[ultrono/laravel-sitemap

Sitemap generator for Laravel 11, 12 and 13

36412.6k6](/packages/ultrono-laravel-sitemap)[mischasigtermans/laravel-toon

Token-Optimized Object Notation encoder/decoder for Laravel with intelligent nested object handling

13113.1k](/packages/mischasigtermans-laravel-toon)[dniccum/nova-documentation

A Laravel Nova tool that allows you to add markdown-based documentation to your administrator's dashboard.

37116.4k](/packages/dniccum-nova-documentation)[sbsaga/toon

🧠 TOON for Laravel — a compact, human-readable, and token-efficient data format for AI prompts &amp; LLM contexts. Perfect for ChatGPT, Gemini, Claude, Mistral, and OpenAI integrations (JSON ⇄ TOON).

6115.6k](/packages/sbsaga-toon)

PHPackages © 2026

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