PHPackages                             taavi/laravel-torblock - 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. [Security](/categories/security)
4. /
5. taavi/laravel-torblock

ActiveLibrary[Security](/categories/security)

taavi/laravel-torblock
======================

Laravel package for blocking Tor exit nodes

3.1.0(8mo ago)31.3kGPL-2.0-or-laterPHPPHP ^8.2CI passing

Since Mar 1Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/supertassu/laravel-torblock)[ Packagist](https://packagist.org/packages/taavi/laravel-torblock)[ RSS](/packages/taavi-laravel-torblock/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (9)Versions (9)Used By (0)

laravel-torblock
================

[](#laravel-torblock)

[![Latest Stable Version](https://camo.githubusercontent.com/ec72f1022ede586d19684db397f4ba31d63bc9dca44cf7bb0f97141d06d787b5/68747470733a2f2f706f7365722e707567782e6f72672f74616176692f6c61726176656c2d746f72626c6f636b2f76)](//packagist.org/packages/taavi/laravel-torblock)[![Total Downloads](https://camo.githubusercontent.com/4f352e1ed99a85b348b9a8e264913ea50529e5ab5d4eb96a886dfadbcafd164c/68747470733a2f2f706f7365722e707567782e6f72672f74616176692f6c61726176656c2d746f72626c6f636b2f646f776e6c6f616473)](//packagist.org/packages/taavi/laravel-torblock)[![License](https://camo.githubusercontent.com/b8923c25c9ed3d0a89b2cfd201f36a05695e402a3836ff480cc0e6c903c8b364/68747470733a2f2f706f7365722e707567782e6f72672f74616176692f6c61726176656c2d746f72626c6f636b2f6c6963656e7365)](//packagist.org/packages/taavi/laravel-torblock)

Block access to use your Laravel application via Tor to prevent abuse.

Usage
-----

[](#usage)

### Getting started

[](#getting-started)

First, install the package:

```
composer require taavi/laravel-torblock

```

Then, the simplest way to use this package is to simply add the middleware to the HTTP kernel:

```
class Kernel extends HttpKernel
{
    protected $routeMiddleware = [
        'torblock' => \Taavi\LaravelTorblock\Middleware\BlockTorAccess::class,
    ];
}
```

After registering the middleware you can just add the `torblock` middleware to any route that you want to prevent Tor access on.

### Advanced usage

[](#advanced-usage)

Internally the middleware just throws a `TorBlocked` exception to prevent access. Laravel's exception handler, by default, displays that as a 403 page and does not log it to the exception log. You can use the exception handler to customize how the user sees that error. You can also use the `vendor:publish` artisan command to publish the language files used to generate the exception message.

Tor exit node data is cached by default for one day. Use the `vendor:publish` artisan command to publish a configuration file to customize the caching duration or the Onionoo server used to load the data from.

### Testing

[](#testing)

To improve test performance, you can swap the package to use a fake implementation of the `TorExitNodeService`:

```
namespace Tests;

use Taavi\LaravelTorblock\Service\FakeTorExitNodeService;
use Taavi\LaravelTorblock\Service\TorExitNodeService;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
    use CreatesApplication;

    protected function setUp(): void
    {
        parent::setUp();

        $this->app->bind(TorExitNodeService::class, FakeTorExitNodeService::class);
    }
}
```

The fake implementation uses two RFC 5737 TEST-NET-1 addresses as the list of blocked addresses.

Credits
-------

[](#credits)

This package is based on the [TorBlock](https://mediawiki.org/wiki/Extension:TorBlock) MediaWiki extension which is licensed GPL-2.0 or later.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance60

Regular maintenance activity

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity70

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

Every ~235 days

Recently: every ~378 days

Total

8

Last Release

254d ago

Major Versions

1.3.0 → 2.0.02023-02-18

2.0.0 → 3.0.02024-07-27

PHP version history (4 changes)v1.0PHP ^7.3|^8.0

1.3.0PHP ^7.4|^8.0

2.0.0PHP ^8.1

3.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/05f22ab65880dd94d6ee0a4a9ba14cd2bddee5a995eef8c41745d9e492bc4e00?d=identicon)[taavi](/maintainers/taavi)

---

Top Contributors

[![supertassu](https://avatars.githubusercontent.com/u/9721638?v=4)](https://github.com/supertassu "supertassu (32 commits)")

---

Tags

laraveltor

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/taavi-laravel-torblock/health.svg)

```
[![Health](https://phpackages.com/badges/taavi-laravel-torblock/health.svg)](https://phpackages.com/packages/taavi-laravel-torblock)
```

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[genealabs/laravel-model-caching

Automatic caching for Eloquent models.

2.4k4.8M26](/packages/genealabs-laravel-model-caching)[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[mikebronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k127.1k1](/packages/mikebronner-laravel-model-caching)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.2k3.3M74](/packages/unisharp-laravel-filemanager)

PHPackages © 2026

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