PHPackages                             gaoqi/php-tuic-client - 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. gaoqi/php-tuic-client

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

gaoqi/php-tuic-client
=====================

TUIC client, managed local proxy, and HTTP request layer for PHP.

v0.1.0(1mo ago)00MITPHPPHP ^8.2CI passing

Since Mar 29Pushed 1mo agoCompare

[ Source](https://github.com/18230/php-tuic-client)[ Packagist](https://packagist.org/packages/gaoqi/php-tuic-client)[ Docs](https://github.com/18230/php-tuic-client)[ RSS](/packages/gaoqi-php-tuic-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

php-tuic-client
===============

[](#php-tuic-client)

[![CI](https://camo.githubusercontent.com/848c4865c14f0bf8a9de4cc6acc23dd59223c52839796a050b2909d51fe12d78/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f31383233302f7068702d747569632d636c69656e742f63692e796d6c3f6272616e63683d6d61696e266c6162656c3d6369)](https://github.com/18230/php-tuic-client/actions/workflows/ci.yml)[![Release](https://camo.githubusercontent.com/6557f3c975c4f1837a5cc5be539b125bf7ee68c40ac3f12160965f69238f9b00/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f31383233302f7068702d747569632d636c69656e743f6c6162656c3d72656c65617365)](https://github.com/18230/php-tuic-client/tags)[![Packagist Version](https://camo.githubusercontent.com/cbe36780cadbff3bba0c5646716e4455b1cb72ed25306dcc4a0da65f8b87796f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f31383233302f7068702d747569632d636c69656e743f6c6162656c3d7061636b6167697374)](https://packagist.org/packages/18230/php-tuic-client)[![Packagist Downloads](https://camo.githubusercontent.com/091a6c057ce7ddccc300d57c642ac291c658c7306736bd541354126d4b897b31/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f31383233302f7068702d747569632d636c69656e743f6c6162656c3d646f776e6c6f616473)](https://packagist.org/packages/18230/php-tuic-client)[![License](https://camo.githubusercontent.com/64e04e2cf16b0a0346882fc6c888ad761d68dd58ed044866e0abb2b9cc7c8565/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f31383233302f7068702d747569632d636c69656e74)](LICENSE)[![PHP](https://camo.githubusercontent.com/0c7c5db561e9b46e883a82a3725af2e635e08c8f63a50fae861dbfdbc0d775d2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322e342532422d373737626234)](https://www.php.net/)

[中文文档](README.zh-CN.md)

`php-tuic-client` is a pure-PHP TUIC client package for PHP 8.2.4+. It provides:

- a native TUIC client implementation over QUIC/TLS
- a local HTTP and SOCKS5 proxy runtime
- a reusable request client for application code
- a Composer package layout that can be integrated into Laravel and ThinkPHP

Features
--------

[](#features)

- PHP 8.2.4+
- Project tooling works on Windows, Linux, and macOS
- Clash-style YAML and JSON node loading
- Inline TUIC node parsing for CLI startup
- Local HTTP proxy and SOCKS5 proxy listeners
- Unified `TuicRequestClient` for application code
- Cross-platform startup scripts
- Cross-platform GitHub Actions CI

Runtime note:

- The current `amphp/quic` package ships native `libquiche` artifacts for Linux and macOS.
- Windows currently supports config parsing, tests, and CLI dry-runs in this repository, but the actual TUIC runtime is blocked by the upstream native binding distribution.

Current Scope
-------------

[](#current-scope)

Implemented:

- TUIC v5 authentication over QUIC/TLS
- Native `http://` requests over TUIC
- `https://` requests through the local proxy plus PHP cURL
- Local HTTP proxy
- Local SOCKS5 proxy
- `doctor` and `run` CLI workflow
- Laravel and ThinkPHP service-provider integration

Not implemented yet:

- UDP relay
- Connection pooling
- Multi-node scheduling
- Long-duration soak validation for very high concurrency

Installation
------------

[](#installation)

Install from Packagist:

```
composer require 18230/php-tuic-client
```

For local development in this repository:

```
composer install
```

Requirements
------------

[](#requirements)

Required PHP extensions:

- `ext-curl`
- `ext-ffi`
- `ext-json`
- `ext-openssl`
- `ext-sockets`

Important note:

- The current QUIC transport dependency is [`amphp/quic`](https://github.com/amphp/quic), and its upstream package is currently published as `dev-master`.
- `php-tuic-client` pins that dependency to a known commit for repeatable installs.
- `doctor` will tell you if `ext-ffi` or other required extensions are missing.

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

[](#quick-start)

Start the local proxy runtime with inline YAML:

```
php bin/tuic-client --node="{ name: 'SG 01', type: tuic, server: your-tuic-server.example.com, port: 443, uuid: 11111111-1111-1111-1111-111111111111, password: your-password, alpn: [h3], disable-sni: false, reduce-rtt: false, udp-relay-mode: native, congestion-controller: bbr, skip-cert-verify: false, sni: your-tuic-server.example.com }"
```

Start with a config file:

```
php bin/tuic-client --config=examples/node.example.yaml
```

Validate the runtime before you start:

```
php bin/tuic-client doctor --config=examples/node.example.yaml
```

Run a single request:

```
php bin/tuic-request --config=examples/node.example.yaml --url=https://api.ipify.org?format=json
```

Check available options:

```
php bin/tuic-client --help
```

Configuration
-------------

[](#configuration)

The main CLI accepts configuration from:

- `--node` with inline YAML or JSON
- `--config` with YAML or JSON files
- `--node-name` when the config contains multiple proxies

Recommended config file structure:

```
proxies:
  - name: "SG 01"
    type: tuic
    server: your-tuic-server.example.com
    port: 443
    uuid: 11111111-1111-1111-1111-111111111111
    password: replace-with-your-password
    alpn: [h3]
    disable-sni: false
    reduce-rtt: false
    udp-relay-mode: native
    congestion-controller: bbr
    skip-cert-verify: false
    sni: your-tuic-server.example.com
```

Useful runtime options:

- `--http-listen=127.0.0.1:8080`
- `--socks-listen=127.0.0.1:1080`
- `--no-http`
- `--no-socks`
- `--node-name=SG 01`
- `--dry-run`

Application Usage
-----------------

[](#application-usage)

### PHP request client

[](#php-request-client)

```
