PHPackages                             ryanj93/php-tor-detector - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. ryanj93/php-tor-detector

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

ryanj93/php-tor-detector
========================

A very simple library to detect Tor connections using PHP 7 without any dependency.

1.1.2(8y ago)129GPL-3.0-or-laterPHPPHP &gt;=7.0

Since Feb 19Pushed 8y ago1 watchersCompare

[ Source](https://github.com/RyanJ93/php-tor-detector)[ Packagist](https://packagist.org/packages/ryanj93/php-tor-detector)[ Docs](https://github.com/RyanJ93/php-tor-detector#readme)[ RSS](/packages/ryanj93-php-tor-detector/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Tor detector
============

[](#tor-detector)

A very simple library to detect Tor connections using PHP 7 without any dependency.

Usage
=====

[](#usage)

Before using the library, you have to set the path to the file that contains the list of all Tor exit points, if you don't have the list you can set an arbitrary file name instead. To set the library path, use this method:

`PHPTorDetector\PHPTorDetector::setListPath('nodes.txt');`

If the file doesn't exist or is empty or you just want to update its content, you can use this method to download the updated list and overwrite new list in the file:

`PHPTorDetector\PHPTorDetector::updateFile();`

Once you have the list, you can check if an IP address is part of the Tor network by using this method:

`$result = PHPTorDetector\PHPTorDetector::isTor('IP ADDRESS HERE');`

If you want to get the IP address of the client you can use this method:

`$address = PHPTorDetector\PHPTorDetector::getClientIPAddress();`

By default, check result is cached within session (if session is enabled and if the script is not executed in CLI), you can disable this feature by using this method:

`PHPTorDetector\PHPTorDetector::setSessionCache(false);`

If you want to change the index where the results will be cached you can use this method:

`PHPTorDetector\PHPTorDetector::setSessionCacheName('tor_cache');`

Note that if you want to set multiple indexes within the session array you can separate indexes with a "@" like this:

`PHPTorDetector\PHPTorDetector::setSessionCacheName('tor@cache');`

In this way, cache will be stored in `$_SESSION['tor']['cache']`.

Are you looking for the Node.js version? Give a look [here](https://github.com/RyanJ93/tor-detector).

###  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

Maturity59

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 ~4 days

Total

2

Last Release

3002d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/18029b3320ad57be78062e5be0584dd20deb3fe5f6fbdfb2d723fafc5a3b8742?d=identicon)[ryanj93](/maintainers/ryanj93)

---

Top Contributors

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

---

Tags

phpphp-libraryphp7tortor-detectorvalidatorproxysecurityutilitiestor

### Embed Badge

![Health badge](/badges/ryanj93-php-tor-detector/health.svg)

```
[![Health](https://phpackages.com/badges/ryanj93-php-tor-detector/health.svg)](https://phpackages.com/packages/ryanj93-php-tor-detector)
```

###  Alternatives

[respect/validation

The most awesome validation engine ever created for PHP

5.9k37.4M383](/packages/respect-validation)[seld/jsonlint

JSON Linter

1.3k217.8M205](/packages/seld-jsonlint)[composer/spdx-licenses

SPDX licenses list and validation library.

1.4k184.2M25](/packages/composer-spdx-licenses)[opis/json-schema

Json Schema Validator for PHP

64236.9M186](/packages/opis-json-schema)[xemlock/htmlpurifier-html5

HTML5 support for HTML Purifier

1052.9M11](/packages/xemlock-htmlpurifier-html5)[laminas/laminas-validator

Validation classes for a wide range of domains, and the ability to chain validators to create complex validation criteria

15544.9M188](/packages/laminas-laminas-validator)

PHPackages © 2026

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