PHPackages                             tourze/proxy-protocol-core - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. tourze/proxy-protocol-core

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

tourze/proxy-protocol-core
==========================

A PHP core library for parsing and generating Proxy Protocol. Supports both V1 (text format) and V2 (binary format) versions.

0.1.0(6mo ago)01431MITPHPCI passing

Since Apr 16Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/tourze/proxy-protocol-core)[ Packagist](https://packagist.org/packages/tourze/proxy-protocol-core)[ RSS](/packages/tourze-proxy-protocol-core/feed)WikiDiscussions master Synced 1mo ago

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

Proxy Protocol Core
===================

[](#proxy-protocol-core)

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

[![Latest Version](https://camo.githubusercontent.com/c16d7665750d0bdfc6694a24adc9aa0aa90c477635db7579e699470f22b813df/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f70726f78792d70726f746f636f6c2d636f72652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/proxy-protocol-core)[![PHP Version](https://camo.githubusercontent.com/86ed1ffff5770db5782a6575d79b6d303d2dd9fee2f1276e5f0700b84ac3fab3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f75727a652f70726f78792d70726f746f636f6c2d636f72652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/proxy-protocol-core)[![License](https://camo.githubusercontent.com/aa56ec5c445511fdb8381e08de7a0c3df87c2960330b808a00e47b68e34b8e0a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f75727a652f70726f78792d70726f746f636f6c2d636f72652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/proxy-protocol-core)[![Code Coverage](https://camo.githubusercontent.com/994d68acb2aadf1c3c7711ddcb3b30429246a6c05da9e601f62c3f932ac795a8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f7665726167652d3130302532352d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](#)[![Build Status](https://camo.githubusercontent.com/6091077cfa1b766f70142bf858d735fab11d849c2d3d3b70434c43f7c7348a87/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f746f75727a652f70726f78792d70726f746f636f6c2d636f72652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/tourze/proxy-protocol-core)[![Quality Score](https://camo.githubusercontent.com/0e79427a5cc6a57438a9d91ac2d99e813633f0a2dd4c92d88613557c7b3cf4f3/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f746f75727a652f70726f78792d70726f746f636f6c2d636f72652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/tourze/proxy-protocol-core)[![Total Downloads](https://camo.githubusercontent.com/2c4f91865068dd50ec8ce940ce3393ffb094eb3aab7bb45308a0f2ce931a65d1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f75727a652f70726f78792d70726f746f636f6c2d636f72652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/proxy-protocol-core)

A PHP core library for parsing and generating Proxy Protocol. Supports both V1 (text format) and V2 (binary format) versions of the protocol with comprehensive data structures and parsing capabilities.

Features
--------

[](#features)

- **Full Protocol Support**: Complete implementation of Proxy Protocol V1 (text format) and V2 (binary format)
- **Type Safety**: Extensive use of PHP 8.1+ enums and type hints for safer protocol constant usage
- **Exception Handling**: Dedicated exception classes for protocol parsing errors
- **Interface-Driven Design**: Common interface for all protocol versions ensuring consistency
- **Comprehensive Address Support**: Support for IPv4, IPv6, and Unix socket addresses
- **PSR Compliance**: Follows PSR-4 autoloading and PSR-12 coding standards

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

[](#requirements)

- PHP 8.1 or higher
- tourze/enum-extra package for enhanced enum functionality

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

[](#installation)

```
composer require tourze/proxy-protocol-core
```

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

[](#quick-start)

### Proxy Protocol V1 (Text Format)

[](#proxy-protocol-v1-text-format)

```
