定制 krak/stream 二次开发

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

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

krak/stream

Composer 安装命令:

composer require krak/stream

包简介

PHP streams and filtering made easy.

README 文档

README

This library provides a simple abstraction over php streams and filters enabling developers to manipulate streams with extreme ease.

Installation

Install with composer at krak/stream

Usage

This example shows kind of a kitchen sink example of what filters are available and how to utilize them.

<?php

use Krak\Stream;
use Krak\Crypto;

$key = random_bytes(16);
$crypt = new Crypto\OpenSSLCrypt($key);

$src = Stream\fromStr('abc def ghi jkl');
$dst = Stream\toOutput();
Stream\pipe($src, [
    Stream\uppercase(), // utilizes string.toupper filter
    Stream\chunkFilter(function($chunk) {
        return str_replace('ABC', 'XYZ', $chunk);
    }),
    Stream\chunkFilter('str_rot13'), // performs rot13 on stream
    Stream\hex(), // performs bin2hex
    Stream\encrypt($crypt),
    Stream\base64Encode(),

    // below are the inverse functions of above which will undo the transformations

    Stream\base64Decode(),
    Stream\decrypt($crypt),
    Stream\unhex(),
    Stream\createFilter('string.rot13'), // creates a filter from a registered php filter
    Stream\chunkFilter(function($chunk) {
        return str_replace('XYZ', 'ABC', $chunk);
    }),
    Stream\lowercase(),
], $dst);

The output of this would simply be: abc def ghi jkl.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-04-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固