PHPackages                             tourze/tls-common - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. tourze/tls-common

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tourze/tls-common
=================

TLS Common

0.0.1(1y ago)04486MITPHPPHP ^8.1CI passing

Since May 18Pushed 6mo ago1 watchersCompare

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

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

TLS Common
==========

[](#tls-common)

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

![PHP Version](https://camo.githubusercontent.com/a766abe18eeb2bd7afe913fa307a1af690f51af3309eada147280e53632453d6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f75727a652f746c732d636f6d6d6f6e2e7376673f7374796c653d666c61742d737175617265)[![License](https://camo.githubusercontent.com/28cb07764ed79653e0f0092f965c60efacb3a273fa1c1a784d7207d02e747059/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f75727a652f746c732d636f6d6d6f6e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Latest Version](https://camo.githubusercontent.com/77dcc05435476ff6402ee98adb55553dcd51e9f982c434fc86f17c8ee579e0e0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f746c732d636f6d6d6f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/tls-common)[![Build Status](https://camo.githubusercontent.com/83f38c24dac1c54566a86d9b0ee5635ec43bc0086f35e7f738af8758c5d32d74/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f746f75727a652f746c732d636f6d6d6f6e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/tourze/tls-common)[![Quality Score](https://camo.githubusercontent.com/a01b3e60bc7a3f5e28bcebd0ab48d04340855c6838f518dbf1825b6ed4b2f560/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f746f75727a652f746c732d636f6d6d6f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/tourze/tls-common)[![Code Coverage](https://camo.githubusercontent.com/dd908c46e0eaba3c17e20dc1f1a886bb362e2f85392a165537f95a8914b9448f/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f746f75727a652f746c732d636f6d6d6f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/tourze/tls-common)[![Downloads](https://camo.githubusercontent.com/dab1f7890e3e44770f149afbc8a023ba8e5ec3cc826e1d0c749572d68b469ffb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f75727a652f746c732d636f6d6d6f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/tls-common)

A PHP package that provides the foundation components for TLS protocol implementation projects, offering common tools, data structures, and constant definitions related to TLS protocols.

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

[](#table-of-contents)

- [Features](#features)
- [Installation](#installation)
- [Requirements](#requirements)
- [Configuration](#configuration)
- [Quick Start](#quick-start)
    - [Using TLS Protocol Versions](#using-tls-protocol-versions)
    - [Using Error Codes](#using-error-codes)
    - [Using Byte Buffer](#using-byte-buffer)
    - [Using Encoding/Decoding Tools](#using-encodingdecoding-tools)
    - [Using Protocol Constants](#using-protocol-constants)
- [Main Components](#main-components)
    - [Protocol Version (Version)](#protocol-version-version)
    - [Error Code (ErrorCode)](#error-code-errorcode)
    - [Byte Buffer (ByteBuffer)](#byte-buffer-bytebuffer)
    - [Utility Classes (Utils)](#utility-classes-utils)
    - [Exception Classes (Exception)](#exception-classes-exception)
    - [Protocol Definitions (Protocol)](#protocol-definitions-protocol)
- [Advanced Usage](#advanced-usage)
    - [Custom Error Handling](#custom-error-handling)
    - [Creating Custom Protocol Messages](#creating-custom-protocol-messages)
    - [Performance Optimization](#performance-optimization)
- [Contributing](#contributing)
- [License](#license)

Features
--------

[](#features)

- 📋 TLS protocol version constant definitions (SSL 3.0 to TLS 1.3)
- 🔢 Standardized error codes and message definitions
- 🔧 Binary data processing tools (ByteBuffer)
- 🌐 Base64 and hexadecimal encoding/decoding tools
- 🚨 Specialized TLS exception class hierarchy
- 📦 Protocol data structure definitions (Alert, Handshake, Content Type, etc.)
- 🔒 Backward-compatible API design

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

[](#installation)

```
composer require tourze/tls-common
```

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

[](#requirements)

- PHP 8.1+
- ext-ctype extension

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

[](#configuration)

No additional configuration is required. Simply install the package and start using the provided classes and constants.

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

[](#quick-start)

### Using TLS Protocol Versions

[](#using-tls-protocol-versions)

```
