定制 squirtle/websocket 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

squirtle/websocket

Composer 安装命令:

composer require squirtle/websocket

包简介

Websocket client and server for Laravel

README 文档

README

This package provides a flexible and high-performance solution that facilitates real-time communication in your Laravel applications.

Features

  • WebSocket Client & Server: Real-time, low-latency, and scalable client-server communication.
  • Pub/Sub Management: A flexible pub/sub architecture for efficient message publishing and sharing.
  • Event-Based Listening: You can listen to events created for both the client and server to execute operations.
  • Extensible Architecture: Driver and broker infrastructure easily extendable to meet your needs.

Requirements

  • PHP 8.2 or higher
  • Laravel 10.x or higher
  • Swoole Extension
  • Redis (For broker support)

Installation

Installation via Composer

Use Composer to add the package to your Laravel project:

composer require squirtle/websocket

Configuration

After installing the package, publish the configuration files:

php artisan vendor:publish --provider="Squirtle\WebSocket\WebSocketServiceProvider"

In the published config/websocket.php file, you can configure Swoole, Redis, and other settings according to your needs.

Usage

Starting the WebSocket Client

You can start your WebSocket client using the following Artisan command:

php artisan websocket:client
php artisan websocket:client --broker=redis --driver=swoole --host=127.0.0.1 --port=6001 --debug

Starting the WebSocket Server

You can start your WebSocket server using the following Artisan command:

php artisan websocket:serve

Event Listening

By creating listener classes, you can listen to events on the WebSocket client/server and perform actions accordingly.

Extensibility

Extending the WebSocket Client

To add your own WebSocket client driver instead of the default Swoole driver, implement the ClientInterface. Define the required methods and configure the package’s settings to make the new driver selectable.

Extending the WebSocket Server

By default, the Swoole driver is used, but you can add your own WebSocket driver to meet your specific needs. To do this, implement the ServerInterface, define the required methods, and make the new driver selectable from the package’s configuration file.

Extending the Broker System

To integrate different broker systems besides Redis, implement the PubSubManager interface to create your custom broker class. Then, configure the necessary settings in your configuration file to activate the new broker.

Contributing

We welcome your contributions! For new feature suggestions, bug fixes, and improvements, please submit a pull request or provide feedback in the issues section.

License

This package is licensed under the MIT License. For details, please refer to the LICENSE file.

squirtle/websocket 适用场景与选型建议

squirtle/websocket 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 03 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「websocket」 「real-time」 「WebSockets」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 squirtle/websocket 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 squirtle/websocket 我们能提供哪些服务?
定制开发 / 二次开发

基于 squirtle/websocket 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 14
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-09