承接 root4root/reshaper 相关项目开发

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

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

root4root/reshaper

Composer 安装命令:

composer require root4root/reshaper

包简介

Reshaper for arrays

README 文档

README

License: MIT Build Status

Implements primitive language which helps transform arrays (rows) i.e. exclude some values (members) or mix them. As a result, you could get array that bigger or smaller than original one.

Library was developed for convinient way to filtering data came from xlsx parser, or any. Language simplicity allows to involve end customers, so they can write filters without help from programmers. That's why A,B,C etc as columns names. Digits are also acceptible, but indexes begins from 1. First element, second and so on.

Quick examle

require_once ('vendor/autoload.php');

use Root4root\Reshaper\Configurator;
use Root4root\Reshaper\Reshaper;

$fields = ['(A)i','(B)s', '(B+C)s'];
$requiredCols = ['(A)i', '(G|H|I)r(/^(?:\s*)[1-9,\+]+(?:\s*)$/)'];

$dataRow = [1, 'PARTNUMBER', 'Part.333', 'Description', 'foo1', 'foo2', '+', 0, 0];

$config = new Configurator($fields, $requiredCols);
$reshaper = new Reshaper($config);

$output = $reshaper->parseRow($dataRow);

print_r($output->getResult());

/*
 * Array
 * (
 *     [0] => 1
 *     [1] => PARTNUMBER
 *     [2] => PARTNUMBER Part.333
 * )
 */

Explanation

There are two arrays for configuration. First one is answering the question «What fields are expected to be created with the output array?» Second formulates rules for validation.

Fields array syntax ($fields in example)
(column)type(extra)

Columns can be separated by a special chars: +, -, *, /.

Types from package:

  • f - float
  • i - integer
  • r - regular expression
  • s - string

Extra: some additional configuration, required for ‘r’ processor. Can be used with ‘i’ and ‘f’ by optional.

Each type handles with certain processor, with its own validation and filed rules. For example, processor 's' will concatenate fields, regardless of separator (B+C) or (B*C). Processor 'i' (integer) and 'f' will calculate the result depending on the math sign.

(A)i(30) - get value from column, convert it to integer and increase by 30%. Same operation with the float type.

You can specify columns by number, starting from 1 (first). Example: '(2+3)s' == '(B+C)s'

Required array syntax ($requiredCols in example)
(column)type(extra)

Columns separators: |,& (or +,* respectevly).

Types: f,i,r,s from package.

(A|B)i - A or B must be > 0

(A&B)s - A and B is not empty strings

(G|H)r(regexp) - A or B must satisfy regular expression.

You should specify required array or its equivalents to field list. This can cause a problem with performance.

Your own types

You can define your own data types or override defaults from package. Create class Processor_type, which implements the Processor Interface.

root4root/reshaper 适用场景与选型建议

root4root/reshaper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 34 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 04 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「arrays」 「reshaper」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 root4root/reshaper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 root4root/reshaper 我们能提供哪些服务?
定制开发 / 二次开发

基于 root4root/reshaper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-04-11