bzrk/http-feeds-server 问题修复 & 功能扩展

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

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

bzrk/http-feeds-server

Composer 安装命令:

composer require bzrk/http-feeds-server

包简介

This project is a PHP Implementation of [HTTP Feeds] (https://github.com/http-feeds/http-feeds).

README 文档

README

This project is a PHP Implementation of [HTTP Feeds] (https://github.com/http-feeds/http-feeds).

HTTP Feeds

Asynchronous event streaming and data replication with plain HTTP APIs.

HTTP feeds is a minimal specification for polling events over HTTP:

  • An HTTP feed provides a HTTP GET endpoint
  • that returns a chronological sequence (!) of events
  • serialized in CloudEvents event format
  • in batched responses using the media type application/cloudevents-batch+json
  • and respects the lastEventId query parameter to scroll through further items
  • to support infinite polling for real-time feed subscriptions.

HTTP feeds can be used to decouple systems asynchronously without message brokers, such as Kafka or RabbitMQ.

Install

composer require bzrk/http-feeds-server

Usage with Slim

...
class Repo implements Repository {

    public function getByIdGreaterThan(string $lastEventId, int $limit): FeedItemCollection
    {
        ....
    }
}

$fetcher = HttpFeedsFetcher::builder(new Repo())->limit(10)->build();

$app = AppFactory::create();
$app->get('/', new HttpFeedsController($fetcher));
$app->addErrorMiddleware(true, true, true);
$app->run();

Usage with ReactPHP

...
class Repo implements Repository {

    public function getByIdGreaterThan(string $lastEventId, int $limit): FeedItemCollection
    {
        ....
    }
}

$fetcher = HttpFeedsFetcher::builder(new Repo())->limit(10)->build();


$http = new React\Http\HttpServer(new HttpFeedsController($fetcher));
$socket = new React\Socket\SocketServer('0.0.0.0:8080');
$http->listen($socket);

Parameters

Name Type Description
lastEventId String last processing eventid from client
timeout Integer enable long polling with specified timeout in seconds

Examples

Polling

http://server.com/inventory

http://server.com/inventory?lastEvenetId=1223

LongPolling

http://server.com/inventory?timeout=5

http://server.com/inventory?lastEvenetId=1223&timeout=5

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-02-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固