承接 streamx/ingestion-client-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

streamx/ingestion-client-php

最新稳定版本:2.0.3

Composer 安装命令:

composer require streamx/ingestion-client-php

包简介

PHP ingestion client for StreamX - a Digital Experience Data Mesh.

README 文档

README

StreamX PHP Ingestion Client enables sending CloudEvents to StreamX via its REST Ingestion Service.

Requirements

PHP 7.4 or higher

Compatibility

The Client is compatible with StreamX 2.x and StreamX Blueprints 3.x

Main entry points:

  • StreamxClientBuilders - with which it's possible to create default or customized clients,
  • StreamxClient - with which it's possible to create publishers
  • Publisher - with which it's possible to make actual ingestions of CloudEvents

Example usage:

<?php
// Start your local StreamX instance.
// The sample assumes rest ingestion service is available at port 8080 and web server sink at port 8081.

// Create test page to be published to StreamX. It can be created as an associative array:
$page = ['content' => base64_encode('Hello, StreamX!')];

// It can also be created as a PHP object that follows the same schema:
class Page {
    public string $content;

    public function __construct(string $content) {
        $this->content = base64_encode($content);
    }
}
$page = new Page('Hello, StreamX!');

// Note: in both approaches, the content has to be in Base64 format.

// Create the client and a publisher dedicated to a specific channel:
$ingestionClient = \Streamx\Clients\Ingestion\Builders\StreamxClientBuilders::create('http://localhost:8080')->build();
$publisher = $ingestionClient->newPublisher();

// Publish page
$key = '/pages/page1.html';
$publishPageEvent = new \CloudEvents\V1\CloudEventImmutable(
    'publish-event',
    'my-source',
    'com.streamx.blueprints.page.published.v1',
    $page,
    'application/json',
    null, // data schema
    $key
);
$publisher->send($publishPageEvent);
// Now the page should be available at http://localhost:8081/pages/page1.html

// Then, unpublish the page (data is not needed)
$unpublishPageEvent = new \CloudEvents\V1\CloudEventImmutable(
    'unpublish-event',
    'my-source',
    'com.streamx.blueprints.page.unpublished.v1',
    null, // data
    null, // data content type
    null, // data schema
    $key
);
$publisher->send($unpublishPageEvent);
// Now the page should be unpublished from http://localhost:8081/pages/page1.html

Installation

The recommended way to install the client is through Composer.

composer require streamx/ingestion-client-php

Run tests with coverage

  1. Install xdebug (with version that supports PHP 7.4):
pecl install xdebug-3.1.5
  1. Configure xdebug mode:
export XDEBUG_MODE=coverage
  1. Run tests with coverage and open results in web browser:
./vendor/bin/phpunit --coverage-text --coverage-html target/coverage-report
open target/coverage-report/index.html

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2025-11-05