承接 pedrotroller/phpetroleum 相关项目开发

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

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

pedrotroller/phpetroleum

Composer 安装命令:

composer require pedrotroller/phpetroleum

包简介

Because at least one good thing comes from petroleum industry

README 文档

README

Because at least one good thing comes from petroleum industry

Build Status Scrutinizer Code Quality

Installation

composer require pedrotroller/phpetroleum ~1.0.0

Usage

Create a simple pipe

$pipe = new PHPetroleum\Pipe('/tmp/pipe');

Then you, are able to write some content on this Pipe

$pipe->write('some content');

Or you can wait for content

$content = $pipe->read();

Use stream

One-way stream

$pipe   = new PHPetroleum\Pipe('/tmp/input');
$stream = new PHPetroleum\Stream\ReaderStream($pipe);
$content = $stream->read();
$pipe   = new PHPetroleum\Pipe('/tmp/output');
$stream = new PHPetroleum\Stream\WriterStream($pipe);
$stream->write($content);

Two-way stream

This stream is using tow pipes, one to read content, the other one to answer.

$input   = new PHPetroleum\Pipe('/tmp/input');
$output  = new PHPetroleum\Pipe('/tmp/output');
$stream  = new PHPetroleum\Stream\TwoWayStream($input, $output);
$content = $stream->read();
$stream->write('Other content');

How did it works

The Pipe object will push two elements into the pipe file, the message size and the message itself. By default, the message size is stored into 8 bytes but you can change the size. For exemle, if you write test, the entire message will be 00000004test (00000004 is the size for the message, test the message itself) If you set the message size length to 6 (php $pipe = new PHPetroleum\Pipe('/tmp/file', 6); ) test will be stored 000004test

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-07-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固