PHPackages                             hejunjie/bililive - 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. hejunjie/bililive

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

hejunjie/bililive
=================

B站直播 WebSocket 连接的核心组件库，提供简洁的接口实现，包括登录、直播间信息流加密/解密、以及相关的关键方法。适合集成到需要对接 Bilibili 直播间的项目中（弹幕监控，礼物答谢、定时广告、关注感谢，自动回复）

v1.0.15(3w ago)61.9k↓90.8%2MITPHPPHP ^8.0

Since Oct 28Pushed 3w ago1 watchersCompare

[ Source](https://github.com/zxc7563598/php-bilibili-danmu-core)[ Packagist](https://packagist.org/packages/hejunjie/bililive)[ RSS](/packages/hejunjie-bililive/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (10)DependenciesVersions (20)Used By (0)

Hejunjie\\Bililive
==================

[](#hejunjiebililive)

English ｜ [简体中文](./README.zh-CN.md)

A core PHP library for Bilibili live streaming WebSocket connections, providing interfaces for login, room operations, and danmu (bullet chat) stream encryption/decryption. Paired with long-running process solutions like Workerman, you can quickly build live room applications such as danmu monitoring, gift acknowledgments, scheduled ads, and auto-replies.

[![PHP Version](https://camo.githubusercontent.com/fe2c2dce35e51fc83d9dd0257aa04b2a71f4d6c639994384010df478a24132c2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230382e302d626c75653f7374796c653d666c61742d737175617265)](https://www.php.net/)[![License](https://camo.githubusercontent.com/422db9fd40f5831c765cf6530b6750c081b696bd18d904cf89554df98c676277/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e3f7374796c653d666c61742d737175617265)](LICENSE)

Warning

This project is for learning and communication purposes only. Commercial or illegal use is strictly prohibited.

**Want a quick overview?** The codebase has been parsed by [Zread](https://zread.ai/zxc7563598/php-bilibili-danmu-core).

Features
--------

[](#features)

- Complete Bilibili QR code login flow with automatic cookie assembly
- Common live room operations: room info, danmu sending, mute management, online rankings, VIP count, and more
- WebSocket packet construction and parsing, with support for Brotli and Zlib encrypted data decryption
- Cookie-free support for select APIs (e.g., fetching basic user info)
- All methods are static — no instantiation required

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

[](#requirements)

- PHP &gt;= 8.0
- [ext-brotli](https://www.php.net/manual/en/book.brotli.php)
- Composer

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

[](#installation)

```
composer require hejunjie/bililive
```

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

[](#quick-start)

A minimal login → room info → WebSocket connection flow:

```
