定制 masakielastic/polling 二次开发

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

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

masakielastic/polling

最新稳定版本:0.1.0

Composer 安装命令:

composer require masakielastic/polling

包简介

Reference implementation of the PHP RFC Polling API using stream_select().

README 文档

README

masakielastic/polling is a Composer-installable reference implementation for the PHP RFC Polling API.

Install

composer require masakielastic/polling

Status

This package currently provides a stream_select()-based implementation.

  • Io\Poll\Backend::Poll is available.
  • Io\Poll\Backend::Auto resolves to Poll.
  • StreamPollHandle is the only supported handle type.
  • Event::EdgeTriggered is not supported.

Usage

<?php

declare(strict_types=1);

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

use Io\Poll\Context;
use Io\Poll\Event;
use Io\Poll\StreamPollHandle;

$context = new Context();
$stream = fopen('php://temp', 'r+');
fwrite($stream, "hello\n");
rewind($stream);

$watcher = $context->add(new StreamPollHandle($stream), [Event::Read], 'demo');
$ready = $context->wait(0, 1000);

foreach ($ready as $triggered) {
    var_dump($triggered->getData(), $triggered->getTriggeredEvents());
}

Examples

Run them from the repository root after installing dependencies:

php examples/basic_tcp_server.php
php examples/basic_tcp_client.php

Development

composer validate
composer test

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固