PHPackages                             ecourty/tor-php - 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. ecourty/tor-php

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

ecourty/tor-php
===============

A Symfony-based HTTP client and ControlPort client for interacting with the Tor network in PHP.

1.2.0(3mo ago)25MITPHPPHP &gt;= 8.4CI passing

Since May 7Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/EdouardCourty/tor-php)[ Packagist](https://packagist.org/packages/ecourty/tor-php)[ RSS](/packages/ecourty-tor-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (6)Versions (6)Used By (0)

TOR-PHP
=======

[](#tor-php)

[![PHP CI](https://github.com/EdouardCourty/tor-php/actions/workflows/php_ci.yml/badge.svg)](https://github.com/EdouardCourty/tor-php/actions/workflows/php_ci.yml)

**TOR-PHP** is a PHP library for Tor network integration. It provides two main components:

- **TorHttpClient** - A Symfony HttpClient implementation that routes HTTP requests through the Tor SOCKS5 proxy for anonymous communication.
- **TorControlClient** - A socket-based client implementing the Tor Control Protocol for managing circuits, configuration, and onion services.

---

Table of Contents
-----------------

[](#table-of-contents)

- [Quick Start](#quick-start)
- [Installation](#installation)
- [Requirements](#requirements)
- [Authentication](#authentication)
    - [Password Authentication](#password-authentication)
    - [Cookie Authentication](#cookie-authentication)
    - [No Authentication](#no-authentication-not-recommended)
- [Features](#features)
    - [HTTP Client Features](#http-client-features)
    - [Control Client Features](#control-client-features)
- [Security Baseline](#security-baseline)
- [Usage Examples](#usage-examples)
    - [Example 1: HTTP Requests via Tor](#example-1-get-current-ip-via-tor)
    - [Example 2: Request a New Identity](#example-2-request-a-new-identity)
    - [Example 3: Manage Your Tor Node](#example-3-manage-your-tor-node)
    - [Example 4: Generate Onion Service Keys](#example-4-generate-onion-service-keys)
- [Changelog](#changelog)
- [Contributing](#contributing)
- [License](#license)

---

Quick Start
-----------

[](#quick-start)

1. **Install and start Tor:**

    ```
    # Debian/Ubuntu
    sudo apt install tor
    sudo systemctl start tor

    # macOS
    brew install tor
    brew services start tor
    ```
2. **Install TOR-PHP:**

    ```
    composer require ecourty/tor-php
    ```
3. **Make your first request:**

    ```
