clue/socks-react
Async SOCKS4/4a/5 proxy connector for ReactPHP. Route TCP connections through a SOCKS server with non-blocking I/O, supporting authentication and DNS resolving via the proxy. Integrates with React\Socket to proxy outgoing connections.
composer require clue/socks-reactreact/socket and react/promise. If you don’t already use ReactPHP, install react/react or the core components individually.$loop = React\EventLoop\Factory::create();
$socket = new React\Socket\Connector($loop, [
'proxy' => 'socks5://user:pass@127.0.0.1:1080'
]);
$socket->connect('http://example.com:80')->then(...);
The proxy configuration is injected via the Connector options — no code changes required for existing ReactPHP-based clients.Clue\React\Socks\Client to wrap an existing ConnectorInterface, enabling SOCKS support for any ReactPHP-compatible client (e.g., HTTP clients like react/http, custom TCP bots, WebSocket clients).$proxyUrl = $isInternal ? 'socks5://internal-proxy:1080' : 'socks4://public-proxy:1080';
$connector = new Clue\React\Socks\Client($socketConnector, $proxyUrl);
$client = new React\Http\Browser($loop, $connector);
user:pass). For complex auth (e.g., GSSAPI, custom methods), extend Client or use the auth option if supported by your proxy server.Connector::connect() chaining or custom logic) for multi-hop anonymization — e.g., Tor + public proxy.socks4:// or socks5:// URIs explicitly. If omitted, default is SOCKS5. SOCKS4a (domain-level resolution) works only via SOCKS5 with SOCKS5_RESOLVE_DOMAIN extension (rarely supported server-side).socks4a://. Clarify which mode you want in URIs.catch() to handle proxy unreachable, auth failure, or DNS resolution errors.Connector is composable but must be explicitly injected.Client instance across requests — creating new connectors per request adds overhead and may exhaust connection slots.squid or dante-server in Docker for local proxy testing. For SOCKS5, ensure AUTH is enabled if testing with credentials.react/dns with tcp fallback) or use a SOCKS5 proxy that supports UDP associate.How can I help you explore Laravel packages today?