PHPackages                             dapphp/torutils - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. dapphp/torutils

ActiveLibrary[HTTP &amp; Networking](/categories/http)

dapphp/torutils
===============

Classes for interacting with Tor over the control protocol, querying directory authorities and servers, DNS exit lists, a curl wrapper that makes it easy to use Tor's SOCKS proxy, and more.

v2.0.0beta1(1y ago)7283.9k↓13%10[2 issues](https://github.com/dapphp/TorUtils/issues)1BSD-3-ClausePHPPHP &gt;=7.3CI failing

Since Oct 11Pushed 5mo ago9 watchersCompare

[ Source](https://github.com/dapphp/TorUtils)[ Packagist](https://packagist.org/packages/dapphp/torutils)[ Docs](https://github.com/dapphp/TorUtils)[ RSS](/packages/dapphp-torutils/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (1)Versions (23)Used By (1)

[![Build Status](https://camo.githubusercontent.com/e2d1c71785419a4ae988cc21cff2b64345f790efbbc6356691463a942afdb188/68747470733a2f2f6170692e7472617669732d63692e636f6d2f6461707068702f546f725574696c732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/dapphp/TorUtils)[![Total Downloads](https://camo.githubusercontent.com/24114a491c7fd4f109ef09cc054875b05ae6ef8c904e041334702ecd6b36b21b/68747470733a2f2f706f7365722e707567782e6f72672f6461707068702f746f727574696c732f646f776e6c6f616473)](https://packagist.org/packages/dapphp/torutils)[![Latest Stable Version](https://camo.githubusercontent.com/dc9395d5d0c306d2176f82b1d1ee3f6bfda820fe49e071c13ab5dadf2b2c7d8e/68747470733a2f2f706f7365722e707567782e6f72672f6461707068702f746f727574696c732f762f737461626c65)](https://packagist.org/packages/dapphp/torutils)

Name:
-----

[](#name)

**Dapphp\\TorUtils** - Classes for interacting with Tor over the control protocol, querying directory authorities and servers, DNS exit lists, a curl wrapper that makes it easy to use Tor's SOCKS proxy, and more.

Version:
--------

[](#version)

**1.15.3**

Author:
-------

[](#author)

Drew Phillips

Requirements:
-------------

[](#requirements)

- PHP 5.5 or greater

Description:
------------

[](#description)

**Dapphp\\TorUtils** provides some PHP libraries for working with Tor. The main functionality focuses on interacting with Tor using the Tor control protocol and provides many methods to make it easy to send commands, retrieve directory and node information, and modify Tor's configuration using the control protocol. A few other utility classes are provided for robustness.

The following classes are provided:

- ControlClient: A class for interacting with Tor's control protocol which can be used to script your Tor relay or learn information about other nodes in the Tor network. With this class you can query directory information through the controller, get and set Tor configuration values, fetch information with the GETINFO command, subscribe to events, and send raw commands to the controller and get back parsed responses.
- DirectoryClient: A class for querying information directly from Tor directory authorities (or any other Tor directory server). This class can be used to fetch information about active nodes in the network by nickname or fingerprint or retrieve a list of all active nodes to get information such as IP address, contact info, exit policies, certs, uptime, flags and more.
- TorDNSEL: A simple interface for querying an address against the Tor DNS exit lists to see if an IP address belongs to a Tor exit node.
- TorCurlWrapper: A wrapper for cURL that ensures HTTP requests are proxied through Tor using SOCKS5 with DNS resolution over Tor (if supported). It also turns cURL errors into an Exception and parses responses into headers and body parts.

Basic Example:
--------------

[](#basic-example)

This library provides a lot of different functionality (see examples directory) and a wide range of possibility but a common use case is sending a signal to the Tor controller to change IP addresses. This shows how to do just that:

```
