PHPackages                             jundayw/frames - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. jundayw/frames

ActiveLibrary[HTTP &amp; Networking](/categories/http)

jundayw/frames
==============

Simple PHP native Frames

v1.0.0(3y ago)010MITPHPPHP &gt;=8.1.0

Since May 27Pushed 3y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

环境要求
====

[](#环境要求)

- `PHP` 8.1 或更高版本

使用方法
====

[](#使用方法)

- 命令行下, 执行 `composer` 命令安装:

```
composer require jundayw/frames
```

接口
==

[](#接口)

WebSocketInterface
------------------

[](#websocketinterface)

```
public function getFin(): int;
public function getOpcode(): int;
public function getMask(): int;
public function getPayloadLength(): int;
public function getMaskingKey(): array;
public function getPayloadData(): string;
public function getPayload(): string;
public function unpack($decode): static;
public function pack($encode, int $opcode = 0x1, bool $finish = true, bool $mask = false): static;
```

客户端打包解包
-------

[](#客户端打包解包)

- 客户端打包数据发送给服务端（Client-pack）：

```
$client = new WebSocket();
// Client pack Server mask true
$client->pack('data', 0x1, true, true);
```

- 客户端解包服务端发送的数据（Client-unpack）：

```
$client = new WebSocket();
$client->unpack('817e00d8e4bb8ee69c8de58aa1e599a8e58f91e5be80e5aea2e688b7e7abafe79a84e695b0e68daee4b99fe698afe5908ce6a0b7e79a84e695b0e68daee5b8a7efbc8ce4bd86e698afe4bb8ee69c8de58aa1e599a8e58f91e98081e588b0e5aea2e688b7e7abafe79a84e695b0e68daee5b8a7e4b88de99c80e8a681e68ea9e7a081e79a84e38082e68891e4bbace887aae5b7b1e99c80e8a681e58ebbe7949fe68890e695b0e68daee5b8a7efbc8ce8a7a3e69e90e695b0e68daee5b8a7e79a84e697b6e58099e68891e4bbace99c80e8a681e58886e78987e38082');
```

服务端打包解包
-------

[](#服务端打包解包)

- 服务端打包数据发送给客户端（Server-pack）：

```
$client = new WebSocket();
// Server pack Client mask false
$client->pack('data', 0x1, true, false);
```

- 服务端解包客户端发送的数据（Server-unpack）：

```
$client = new WebSocket();
$client->unpack('81fe00d818230807fc9886e184aeed8db9c691affdac99e2a6a3eda9bac580b0ff88a7e082a7ee92a8c585a9fc9a97e1808ced9794c5a8b0ffb98ce18d93ee8ab6c6b0a0f79f84e3a5a5ee9fb7c7b389febf85e29282ed9eb0c68796f1a389e29093eda9bac580b0ff88a7e082a7ee92a8c585a9fd9bafe3a0aee19b98cbae86feada1e0b8a2ef9d9cc08885feab99e3a38fe080b2c6bfb6f1bf88efbea2ed89a3c49c98feab98e18d93ee8ab6c6b0a0f79f84efbf80ee9988c59db7feaea6e2a084ef9d9cc59fb1fda391e190b2ecbcb4ca9487f08589e290a5ef8e9fc08885');
```

数据帧类型
-----

[](#数据帧类型)

常量对应值说明WEBSOCKET\_OPCODE\_TEXT0x1UTF-8 文本字符数据WEBSOCKET\_OPCODE\_BINARY0x2二进制数据WEBSOCKET\_OPCODE\_CLOSE0x8关闭帧类型数据WEBSOCKET\_OPCODE\_PING0x9ping 类型数据WEBSOCKET\_OPCODE\_PONG0xapong 类型数据

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

1133d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16873970?v=4)[Xander Moore](/maintainers/jundayw)[@jundayw](https://github.com/jundayw)

---

Top Contributors

[![jundayw](https://avatars.githubusercontent.com/u/16873970?v=4)](https://github.com/jundayw "jundayw (1 commits)")

---

Tags

unpackwebsocket

### Embed Badge

![Health badge](/badges/jundayw-frames/health.svg)

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

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25126.1M82](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.9M6.9k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k24.3k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87965.9k114](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.4M90](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69127.2k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

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