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(2y ago)010MITPHPPHP &gt;=8.1.0

Since May 27Pushed 2y ago1 watchersCompare

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

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 27% 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

1084d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2da9b458375a1b7972b7c4d26a5bf8f3e48db305e8805da36f253956f33c5568?d=identicon)[jundayw](/maintainers/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

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

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