PHPackages                             lukaswhite/auto-no-follow - 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. lukaswhite/auto-no-follow

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

lukaswhite/auto-no-follow
=========================

Automatically add rel=nofollow to links in HTML, using PHP

1.0.0(7y ago)011MITPHP

Since Jan 14Pushed 7y ago1 watchersCompare

[ Source](https://github.com/lukaswhite/auto-no-follow)[ Packagist](https://packagist.org/packages/lukaswhite/auto-no-follow)[ RSS](/packages/lukaswhite-auto-no-follow/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (3)Versions (2)Used By (0)

Auto No Follow
==============

[](#auto-no-follow)

This simple PHP package has one simple purpose; to take some HTML (as a string), go through it and add `rel="nofollow"` to all links, subject to certain exceptions.

So give it this:

```
Check out our affordable web design services!
```

...and you get this:

```
Check out our affordable web design services!
```

By default, it will ignore relative links, so this would remain untouched:

```
Check out the about page
```

It will also ignore absolute links to the current domain.

You can also provide a whitelist of domains, and it will skip them.

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

[](#installation)

```
composer require lukaswhite/auto-no-follow
```

Usage
-----

[](#usage)

Create an instance:

```
$processor = new \Lukaswhite\AutoNoFollow\Processor();
```

Optionally specify the current host:

```
$processor->setCurrentHost('example.com');
```

> If you don't set this, it'll grab it from `$_SERVER['HTTP_HOST']`

Then run:

```
$html = $processor->addLinks('Check out our affordable web design services!');
```

The method signature is this:

```
public function addLinks($html, $whitelist = array(), $ignoreRelative = true)
```

So, to whitelist certain hosts:

```
$html = $processor->addLinks(
  'Check out our affordable web design services!'
  [
  	'example.com'
  ]
);
```

To add `nofollow` to relative links anyway, set the third argument to true, e.g.:

```
$html = $processor->addLinks(
  'Check out the about page'
  [],
  TRUE
);
```

This will output the following:

```
Check out the about page
```

Tests
-----

[](#tests)

The package contains tests, to run them:

```
./vendor/bin/phpunit
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

2675d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f1bd633ffdf0f66a73a288c4edcacfa43d214cd95a53384c6fe5ea4b3554dd9d?d=identicon)[lukaswhite](/maintainers/lukaswhite)

---

Top Contributors

[![lukaswhite](https://avatars.githubusercontent.com/u/999014?v=4)](https://github.com/lukaswhite "lukaswhite (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lukaswhite-auto-no-follow/health.svg)

```
[![Health](https://phpackages.com/badges/lukaswhite-auto-no-follow/health.svg)](https://phpackages.com/packages/lukaswhite-auto-no-follow)
```

###  Alternatives

[phpjuice/slopeone

PHP implementation of the Weighted Slope One rating-based collaborative filtering scheme.

868.7k](/packages/phpjuice-slopeone)[thisisbd/silverstripe-fontawesome-iconpickerfield

Font Awesome Icon Picker for SilverStripe 3.1.x based on http://mjolnic.com/fontawesome-iconpicker

143.3k1](/packages/thisisbd-silverstripe-fontawesome-iconpickerfield)

PHPackages © 2026

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