2017 © Pedro Peláez
 

library sloth

Data manipulaton tool

image

weby/sloth

Data manipulaton tool

  • Wednesday, July 25, 2018
  • by maximiliamus
  • Repository
  • 0 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 100 % Grown

The README.md

Weby\Sloth

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., (*1)

Installation

composer require weby/sloth:v0.1

Usage

See examples folder for more info., (*2)

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:, (*3)

vendor/bin/phpunit

Documentation

The documentation is located in this repo's wiki., (*4)

License

Weby\Sloth is distributed under the MIT license., (*5)

The Versions

25/07 2018

v0.x-dev

0.9999999.9999999.9999999-dev https://github.com/maximiliamus/weby-sloth

Data manipulaton tool

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

php reporting data analysis data manipulation group array pivot array

25/07 2018

dev-master

9999999-dev https://github.com/maximiliamus/weby-sloth

Data manipulaton tool

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

php reporting data analysis data manipulation group array pivot array

29/05 2018

v0.1

0.1.0.0 https://github.com/maximiliamus/weby-sloth

Data manipulaton tool

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

php reporting data analysis data manipulation group array pivot array