Download the PHP package tourze/workerman-proxy-protocol without Composer
On this page you can find all versions of the php package tourze/workerman-proxy-protocol. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package workerman-proxy-protocol
Workerman Proxy Protocol
中文
A Proxy Protocol implementation for Workerman framework, supporting both V1 and V2 versions.
Features
- Support for Proxy Protocol V1 and V2 versions
- Compatible with Workerman framework protocol interface
- Automatic parsing of proxy protocol headers
- Uses WeakMap to manage connection-to-header mapping, preventing memory leaks
- Strict compliance with HAProxy Proxy Protocol specification
- Support for TCP4, TCP6, and UNKNOWN connection types
Installation
Requirements
- PHP >= 8.1
- Workerman >= 5.1
- tourze/proxy-protocol-core
Quick Start
Using Proxy Protocol V1
Using Proxy Protocol V2
Using with Reverse Proxies
When using servers like HAProxy or Nginx that support proxy protocol as frontend proxies, you need to enable proxy protocol support in the proxy configuration:
HAProxy Configuration Example
Nginx Configuration Example
API Documentation
HeaderMap Class
Static methods for managing connection-to-header mapping:
HeaderMap::get(ConnectionInterface $connection): ?HeaderInterface- Get proxy protocol header for connectionHeaderMap::set(ConnectionInterface $connection, HeaderInterface $header): void- Set proxy protocol header for connectionHeaderMap::has(ConnectionInterface $connection): bool- Check if connection has proxy protocol headerHeaderMap::remove(ConnectionInterface $connection): void- Remove proxy protocol header for connection
Header Interface
Proxy protocol header objects implement HeaderInterface interface, providing these methods:
getSourceIp(): string- Get client source IPgetSourcePort(): int- Get client source portgetTargetIp(): string- Get target server IPgetTargetPort(): int- Get target server portgetProtocol(): string- Get protocol type (TCP4, TCP6)
License
The MIT License (MIT). Please see LICENSE for more information.
References
All versions of workerman-proxy-protocol with dependencies
PHP Build Version
Package Version
Requires
tourze/proxy-protocol-core Version
0.1.*
tourze/workerman-connection-pipe Version 0.0.*
workerman/workerman Version ^5.1
tourze/workerman-connection-pipe Version 0.0.*
workerman/workerman Version ^5.1
The package tourze/workerman-proxy-protocol contains the following files
Loading the files please wait ...