dunglas / php-torcontrol
Tor control library
Fund package maintenance!
dunglas
Installs: 5 241
Dependents: 2
Suggesters: 0
Security: 0
Stars: 88
Watchers: 10
Forks: 20
Open Issues: 1
Requires
- php: >=5.4
This package is auto-updated.
Last update: 2024-11-27 03:27:19 UTC
README
TorControl is a PHP library to control a Tor server.
Features
- 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
Installation
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
Usage
<?php // Autoloading using composer require 'vendor/autoload.php'; // Connect to the TOR server using password authentication $tc = new TorControl\TorControl( array( 'hostname' => 'localhost', 'port' => 9051, 'password' => 'MySecr3tPassw0rd', 'authmethod' => 1 ) ); $tc->connect(); $tc->authenticate(); // Renew identity $res = $tc->executeCommand('SIGNAL NEWNYM'); // Echo the server reply code and message echo $res[0]['code'].': '.$res[0]['message']; // Quit $tc->quit();
Related
Credits
PHP TorControl has been created by Kévin Dunglas.