PHPackages                             rah/rah\_ip\_range - 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. rah/rah\_ip\_range

ActiveTextpattern-plugin[Utility &amp; Helpers](/categories/utility)

rah/rah\_ip\_range
==================

Block Textpattern CMS visitors based on IP ranges from within templates

0.5.0(4y ago)181GPL-2.0PHPPHP &gt;=5.6.0CI passing

Since Apr 17Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/gocom/rah_ip_range)[ Packagist](https://packagist.org/packages/rah/rah_ip_range)[ Docs](https://github.com/gocom/rah_ip_range)[ Fund](https://www.paypal.me/jukkasvahn)[ RSS](/packages/rah-rah-ip-range/feed)WikiDiscussions master Synced 3d ago

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

rah\_ip\_range
==============

[](#rah_ip_range)

[Download](https://github.com/gocom/rah_ip_range/releases) | [Packagist](https://packagist.org/packages/rah/rah_ip_range) | [Issues](https://github.com/gocom/rah_ip_range/issues)

Rah\_ip\_range is a [Textpattern CMS](https://textpattern.com) plugin for restricting visitors’ access to certain parts of site content based on their IP addresses. The plugin introduces a little Textpattern tag that takes an IP address range and an executed action. The tag can either be used to hide parts of a page template or to invoke a customizable error page.

Install
-------

[](#install)

Using [Composer](https://getcomposer.org):

```
$ composer require rah/rah_ip_range
```

Or [download](https://github.com/gocom/rah_ip_range/releases) an installer package.

Basics
------

[](#basics)

```

    ...contained statements...

```

The plugin introduces a new Textpattern tag, ``. The tag can be used to restrict visitor’s access to certain parts of page template content or full pages based on their IP address. The tag takes an IP range, set by `from` and `to` attributes. A visitor that is in the specified range will be either denied or allowed access to the content based on `deny` or `allow` boolean attribute.

The tag can be used both as a container and as a self-closing single tag. When used as single tag, the tag invokes an error page when the visitor is within denied range. As a container, the tag hides the wrapped content, but doesn’t invoke an error page. A container can also take a [else](https://docs.textpattern.com/tags/else) statement, which is served as an alternative content to denied visitors.

Attributes
----------

[](#attributes)

**message**
Error message shown to blocked visitors.
Example: `message="Sorry, we can not do that."` Default: `"Forbidden."`

**status**
HTTP error status code returned to blocked visitors. The option is ignored when the tag is used as a container.
Example: `status="404"` Default: `"403"`

**from**
IP-range’s starting IP (or partial IP). Default is unset.
Example: `from="127.0.0.1"` Default: `""`

**to**
IP-range’s ending IP (or partial IP). Default is unset.
Example: `to="127.0.0.100"` Default: `""`

**allow**
Allow visitors within the specified IP range. This is the default action.
Example: `allow` Default: `allow`

**deny**
Deny visitors within the specified IP range. Opposite of **allow**.
Example: `deny` Default: *undefined*

Examples
--------

[](#examples)

### Using as a self-closing single tag

[](#using-as-a-self-closing-single-tag)

```

```

Visitors within the range of 127.0.0.1-127.0.0.100 are blocked will see an error page.

### Using as a container

[](#using-as-a-container)

```

    Important link.

    Link is hidden.

```

Visitors within the range 127.0.0.1-127.0.0.100 will see an important link, while others won’t. Instead they are treated with *“Link is hidden.”* message where the link would be.

Changelog
---------

[](#changelog)

### Version 0.5.0 – 2022/04/17

[](#version-050--20220417)

- Register the tag for Textpattern &gt;= 4.7.0 compatibility.
- Rename `fromip` to `from`, `toip` to `to`, split `method` attribute to `allow` and `deny` boolean attributes.
- Now requires Textpattern &gt;= 4.7.0.

### Version 0.4 – 2012/07/13

[](#version-04--20120713)

- Added: [else](https://docs.textpattern.com/tags/else) (``) tag support for container mode.
- Changed: default HTTP status to *403 Forbidden* from *503 Service Unavailable*.
- Changed: default message to `Forbidden.`, `403_forbidden` l18n string.
- Changed: `message` attribute doesn’t apply when tag is used as a container, instead of [else](https://docs.textpattern.com/tags/else) can be used.

### Version 0.3 – 2011/06/29

[](#version-03--20110629)

- Changed: parsing contents of `message` isn’t needed. Parser’s straight quote feature can be used instead.
- Changed: pass parameters to `txp_die()` as strings instead of an array.

### Version 0.2 – 2011/06/25

[](#version-02--20110625)

- Added: container tag mode.

### Version 0.1 – 2008/10/31

[](#version-01--20081031)

- Initial release.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance40

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 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

1489d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3a34b4e1b662cd2c926e8e89a76f93df266b199fe61508d38026cb952f28e59e?d=identicon)[rah](/maintainers/rah)

---

Top Contributors

[![gocom](https://avatars.githubusercontent.com/u/665186?v=4)](https://github.com/gocom "gocom (13 commits)")

---

Tags

phptextpatterntextpattern-pluginplugintextpattern

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/rah-rah-ip-range/health.svg)

```
[![Health](https://phpackages.com/badges/rah-rah-ip-range/health.svg)](https://phpackages.com/packages/rah-rah-ip-range)
```

PHPackages © 2026

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