PHPackages                             fastd/packet - 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. fastd/packet

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

fastd/packet
============

v1.4.1(9y ago)329.5k12PHPPHP &gt;=5.6

Since May 20Pushed 9y ago1 watchersCompare

[ Source](https://github.com/fastdlabs/packet)[ Packagist](https://packagist.org/packages/fastd/packet)[ RSS](/packages/fastd-packet/feed)WikiDiscussions master Synced today

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

packet
======

[](#packet)

[![Build Status](https://camo.githubusercontent.com/7e27c76f0cea9a62320dc0f2a0cdc32f4efcc77c137d8aa913e6c8cdc3f9c8b3/68747470733a2f2f7472617669732d63692e6f72672f4a616e4875616e672f7061636b65742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/JanHuang/packet)[![Latest Stable Version](https://camo.githubusercontent.com/59a520858fdeda8d2fc63a36d854a63bb80112501e82f6075fee2037d099a8b0/68747470733a2f2f706f7365722e707567782e6f72672f66617374642f7061636b65742f762f737461626c65)](https://packagist.org/packages/fastd/packet)[![Total Downloads](https://camo.githubusercontent.com/f9a7fed7f0f5a9e652282bc781b694dc1476e55d9b14d67a52ae2d0524c20a33/68747470733a2f2f706f7365722e707567782e6f72672f66617374642f7061636b65742f646f776e6c6f616473)](https://packagist.org/packages/fastd/packet)[![Latest Unstable Version](https://camo.githubusercontent.com/b97db191812e8096a73673d7105056543f906482a87e92e116ad6253ea9ce974/68747470733a2f2f706f7365722e707567782e6f72672f66617374642f7061636b65742f762f756e737461626c65)](https://packagist.org/packages/fastd/packet)[![License](https://camo.githubusercontent.com/31fa047c70dcee550f8144b0d0c8259df7c42eabe02fc54de21ab110f3c02a0d/68747470733a2f2f706f7365722e707567782e6f72672f66617374642f7061636b65742f6c6963656e7365)](https://packagist.org/packages/fastd/packet)[![composer.lock](https://camo.githubusercontent.com/ac9350339111c3010feb1f4038afcd057875a059a11ec2f72833ca99d1e8d9b5/68747470733a2f2f706f7365722e707567782e6f72672f66617374642f7061636b65742f636f6d706f7365726c6f636b)](https://packagist.org/packages/fastd/packet)

PHP 数据打包、解包工具，支持二进制，json格式.

### ＃composer

[](#composer)

```
{
    "require": {
        "fastd/packet": "~1.1"
    }
}
```

### ＃使用

[](#使用)

二进制数据打包的时候程序会将内容加入 “盐(SALT)” 来强化数据安全性，如果需要自定义盐值，需要在实现类中重写 `FastD\Packet\PacketInterface::SALT` 类常量。

##### ＃二进制

[](#二进制)

```
use FastD\Packet\Binary;

$origin = ['name' => 'janhuang'];

$data = Binary::encode($origin);
$origin = Binary::decode($data);

/**
 * Array(
 *      "name" => "janhuang"
 * )
 */
```

##### ＃JSON

[](#json)

JSON 数据在打包的时候同样会加入盐值，程序自行追加，并且会对盐值进行在加密，在数据处理解析返回会自动移除盐值，返回纯净数据。因此在传入数据的时候需要注意不要存在 `packet_salt` 字段。

```
use FastD\Packet\Json;

$origin = ['name' => 'janhuang'];

$data = Json::encode($origin);
$origin = Json::decode($data);

/**
 * Array(
 *      "name" => "janhuang"
 * )
 */
```

### ＃Testing

[](#testing)

```
phpunit

```

License MIT
===========

[](#license-mit)

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~34 days

Total

11

Last Release

3353d ago

PHP version history (3 changes)1.0.x-devPHP &gt;=7.0

v1.2.0PHP &gt;=5.4

v1.3.0PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/94c2bc821caf23977e1c3deea85e3cbc9a73a632e1afaf778638f7fe9da1c42b?d=identicon)[JanHuang](/maintainers/JanHuang)

---

Top Contributors

[![JanHuang](https://avatars.githubusercontent.com/u/7090871?v=4)](https://github.com/JanHuang "JanHuang (16 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fastd-packet/health.svg)

```
[![Health](https://phpackages.com/badges/fastd-packet/health.svg)](https://phpackages.com/packages/fastd-packet)
```

###  Alternatives

[ishanvyas22/asset-mix

Asset Mix plugin for CakePHP

3476.9k2](/packages/ishanvyas22-asset-mix)[caouecs/bootstrap3

Bootstrap 3 for Laravel 4

111.9k](/packages/caouecs-bootstrap3)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
