weby/sloth 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

weby/sloth

Composer 安装命令:

composer require weby/sloth

包简介

Data manipulaton tool

README 文档

README

This PHP's library provides simple data manipulaton tools and may be used for simple data analysis, transforming and reporting. For example, it provides such operations for input data as "group by", "pivot" and additional aggregate functions that may be applied to this operations.

Installation

composer require weby/sloth:v0.1

Usage

See examples folder for more info.

Input data

// examples/data.php:
$data = [
    ['foo' => 'one', 'bar' => 'A', 'baz' => 1],
    ['foo' => 'one', 'bar' => 'B', 'baz' => 2],
    ['foo' => 'one', 'bar' => 'C', 'baz' => 3],
    ['foo' => 'two', 'bar' => 'A', 'baz' => 4],
    ['foo' => 'two', 'bar' => 'B', 'baz' => 5],
    ['foo' => 'two', 'bar' => 'C', 'baz' => 6],
];

"Group" operation

// examples/group.php:
require_once '../vendor/autoload.php';

use Weby\Sloth\Sloth;

include_once 'data.php';

Sloth::from($data)
    ->group('foo', 'baz')
    ->count()
    ->sum()
    ->avg()
    ->print();

// Outputs:
// foo      count   sum      avg
// one      3       6        2
// two      3       15       5

"Pivot" operation

// examples/pivot.php:
require_once '../vendor/autoload.php';

use Weby\Sloth\Sloth;

include_once 'data.php';

Sloth::from($data)
    ->pivot('foo', 'bar', 'baz')
    ->print();

// Outputs:
// foo     A       B       C
// one     1       2       3
// two     4       5       6

Tests

Running the tests is simple:

vendor/bin/phpunit

Documentation

The documentation is located in this repo's wiki.

License

Weby\Sloth is distributed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-03-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固