murdej/sse 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

murdej/sse

最新稳定版本:1.0.1

Composer 安装命令:

composer require murdej/sse

包简介

PHP server site event helper

README 文档

README

This PHP library simplifies the use of Server-Sent Events (SSE) in your PHP applications.

Installation

You can install this library via Composer:

composer require murdej/sse

Usage

Here's a basic example of how to use the library:

<?php

use Murdej\Sse\SseService;

require_once __DIR__ . '/../vendor/autoload.php';

$sse = new SSEService();

for ($i = 0; $i < 4; $i++) {
    $sse->sendMessage(['index' => $i, 'dt' => time()]);
    sleep(1);
}

Client site JavaScript

Here's an example of how to use this library with JavaScript on the client side:

const es = new EventSource('./sse-service.php');

es.onmessage = (messsage) => {
    log.innerText += messsage.data + "\n"
}
es.onerror = (ev) => {
    es.close();
}

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue.

License

This library is licensed under the MIT License.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2025-02-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固