承接 varion/transport 相关项目开发

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

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

varion/transport

最新稳定版本:v0.1.0

Composer 安装命令:

composer require varion/transport

包简介

User-facing facade for the Varion Transport API

README 文档

README

User-facing facade for the experimental Varion Transport API.

What this package is

varion/transport provides a small, stable entry point for application code. It does not implement network transport itself. Instead, it delegates to an injected driver that implements varion/transport-contracts.

Package roles in the architecture

  • varion/transport-contracts: shared interfaces only
  • varion/transport: facade layer used by applications
  • varion/driver-*: concrete implementations (for example, varion/driver-stream)

This keeps the API explicit and testable: your app depends on one facade, and you choose a compatible driver package separately.

Installation

composer require varion/transport

Install a compatible driver package as well, for example:

composer require varion/driver-stream

Usage (client)

<?php

declare(strict_types=1);

use Varion\Transport\Driver\Stream\StreamDriver;
use Varion\Transport\Transport;

$transport = new Transport(new StreamDriver());

$conn = $transport->connect('tcp://127.0.0.1:8080');
$conn->write("ping\n");
$response = $conn->read(1024);
$conn->close();

Usage (server)

<?php

declare(strict_types=1);

use Varion\Transport\Driver\Stream\StreamDriver;
use Varion\Transport\Transport;

$transport = new Transport(new StreamDriver());

$listener = $transport->listen('tcp://127.0.0.1:8080');

while ($conn = $listener->accept()) {
    $data = $conn->read(1024);
    $conn->write("HTTP/1.0 200 OK\\r\\nContent-Length: 2\\r\\n\\r\\nOK");
    $conn->close();
}

API surface

  • Transport::__construct(DriverInterface $driver)
  • Transport::connect(string $uri, array $options = []): ConnectionInterface
  • Transport::listen(string $uri, array $options = []): ListenerInterface
  • Transport::driver(): DriverInterface

connect() and listen() validate that the URI is non-empty and then delegate to the injected driver.

Development

composer install
vendor/bin/phpunit

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固