PHP TorControl, a library to control TOR
Switch branches/tags
Nothing to show
Clone or download
Latest commit ef908ba Jan 22, 2016
Failed to load latest commit information.
src Switch to PSR-4 Jan 22, 2016
tests Switch to PSR-4 Jan 22, 2016
.gitignore Repository cleanup Jan 13, 2014
.travis.yml Test new PHP versions Jan 22, 2016
LICENSE First release Feb 23, 2013 Add StyleCI badge Jan 22, 2016
composer.json Switch to PSR-4 Jan 22, 2016
phpunit.xml.dist Switch to PSR-4 Jan 22, 2016

PHP TorControl, a library to control TOR

TorControl is a PHP library to control a Tor server.

Build Status SensioLabsInsight StyleCI


  • Connect to a Tor server through network socket, SSL network socket or UNIX socket
  • Support null, password and cookie file authentication methods
  • Automatic authentication for null and cookie file methods
  • Multi-line replies
  • Unit-tested with PHPUnit
  • Installation with Composer


Note: if you use the Symfony framework, you should use DunglasTorControlBundle.

If not already done, install Composer.

Add php-torcontrol to your composer.json:

composer require dunglas/php-torcontrol



// Autoloading using composer
require 'vendor/autoload.php';

// Connect to the TOR server using password authentication
$tc = new TorControl\TorControl(
        'hostname' => 'localhost',
        'port'     => 9051,
        'password' => 'MySecr3tPassw0rd',
        'authmethod' => 1



// Renew identity
$res = $tc->executeCommand('SIGNAL NEWNYM');

// Echo the server reply code and message
echo $res[0]['code'].': '.$res[0]['message'];

// Quit



PHP TorControl has been created by Kévin Dunglas.