PHPackages                             tourze/tls-record - 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-record

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

tourze/tls-record
=================

TLS Record

0.0.1(1y ago)027MITPHPPHP ^8.1CI failing

Since May 19Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/tourze/tls-record)[ Packagist](https://packagist.org/packages/tourze/tls-record)[ RSS](/packages/tourze-tls-record/feed)WikiDiscussions master Synced today

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

TLS-Record
==========

[](#tls-record)

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

[![Latest Version](https://camo.githubusercontent.com/a203b49a77bb8249990897504ccb3a4c5d139d414ed1a6bab43c531040014d7c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f746c732d7265636f72642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/tls-record)[![PHP Version Require](https://camo.githubusercontent.com/7b5fb9d25021123d8550220fee62394754f5cfce40b8f9be83bee428d3bba4eb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f75727a652f746c732d7265636f72642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/tls-record)[![License](https://camo.githubusercontent.com/03bbb00b9f09cc9229e7b51f6f9e29e4bed5e64119486593f83bc36d3d676ff5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f75727a652f746c732d7265636f72642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/tls-record)[![Quality Score](https://camo.githubusercontent.com/cedb73cae4f6b0bf90922609f253798c89ff7cd8b5d1ee742b9ceaa52a8f485d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f746f75727a652f746c732d7265636f72642e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/tourze/tls-record)[![Code Coverage](https://camo.githubusercontent.com/25252f1e49960b4adb39f579b7d34f8c6aaa2da1a14c88242697bfa641baaabb/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f746f75727a652f746c732d7265636f72642e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/tourze/tls-record)[![Total Downloads](https://camo.githubusercontent.com/92f8b6cf6825e20b699f92a11d1e47824d805dc3e8cfed8ba55bff8c320db034/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f75727a652f746c732d7265636f72642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/tls-record)

TLS-Record package implements the Record Layer of the TLS protocol, which is one of the core components of TLS.

The Record Layer is responsible for fragmenting data into manageable blocks, applying encryption and integrity protection to these blocks, and then encapsulating them into a consistent format for transmission.

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

[](#table-of-contents)

- [Features](#features)
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Basic Usage](#basic-usage)
    - [Creating a Record Layer Instance](#creating-a-record-layer-instance)
    - [Sending Records](#sending-records)
    - [Receiving Records](#receiving-records)
    - [Switching to Encrypted Mode](#switching-to-encrypted-mode)
    - [Setting Maximum Fragment Length](#setting-maximum-fragment-length)
- [Custom Transport Layer](#custom-transport-layer)
- [Requirements](#requirements)
- [Dependencies](#dependencies)
- [Architecture](#architecture)
- [API Reference](#api-reference)
    - [RecordLayer Interface](#recordlayer-interface)
- [Contributing](#contributing)
- [Security](#security)
- [License](#license)

Features
--------

[](#features)

- Complete implementation of the TLS Record Layer protocol
- Support for TLS 1.0, 1.1, 1.2, and 1.3
- Record fragmentation and reassembly
- Encryption and MAC protection
- Buffer management and optimization
- Defense against common TLS attacks (padding oracle, replay attacks)
- Pluggable transport layer interface
- Version-specific adapters for protocol differences

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

[](#installation)

```
composer require tourze/tls-record
```

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

[](#quick-start)

```
