2017 © Pedro Peláez
 

library hurl

PHP7 language wrapper

image

sysvyz/hurl

PHP7 language wrapper

  • Tuesday, November 7, 2017
  • by mo-ba
  • Repository
  • 2 Watchers
  • 1 Stars
  • 20 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Hurl

Hurl is a data transformation framework, designed to compose complex transformations., (*1)

Installation

You will need composer require sysvyz/hurl, (*2)

Usage

Hurl is designed to build algorithms as datastructures. Each algorithm is represented by a tree. A tree is represented by its root node. Trees should be stateless (and immutable) in order to reuse them. A Node represents a data transformation., (*3)

Creating Nodes

A Node is basically wrapper for functions or Closures if you like. Like functions Nodes have inputs(parameters) and a output., (*4)


$fromHex = Node::call(function ($data) { return hexdec($data); }); var_dump($fromHex('a')); //int(10)

Build-in transformations

Nodes are transformation rules. There are several build-in php functions wrapped as Node, (*5)



$explode = Node::explode('.'); var_dump($explode('a.b')); //array(2) { // [0]=> // string(1) "a" // [1]=> // string(1) "b" //}

Chained transformations

Nodes can be chained to perform multiple consecutive transformations, (*6)



$chain = $explode->implode('-'); var_dump($chain('a.b')); //string(3) "a-b"

Map

One of the most common transformation is array_map. Node provides a convenient way of performing those operations. Since the callback function of array_map is nothing else than a transformation, it's obvious to use Nodes as callbacks., (*7)



$map = $explode->map($fromHex)->implode('.'); var_dump($map('a.b')); //string(5) "10.11"

Sort



$sort = Node::ARRAY()->sort(function ($a,$b){ return $a-$b; }); var_dump($sort([2,5,3,4,1])); //array(5) { // [0]=> // int(1) // [1]=> // int(2) // [2]=> // int(3) // [3]=> // int(4) // [4]=> // int(5) //}

The Versions

07/11 2017

dev-master

9999999-dev https://github.com/sysvyz/hurl

PHP7 language wrapper

  Sources   Download

MIT

The Requires

 

The Development Requires

language wrapper

24/07 2016

dev-cofi

dev-cofi https://github.com/sysvyz/hurl

PHP7 language wrapper

  Sources   Download

MIT

The Requires

 

The Development Requires

language wrapper

18/07 2016

1.0.0-alpha.0.4

1.0.0.0-alpha0.4 https://github.com/sysvyz/hurl

PHP7 language wrapper

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

language wrapper

28/05 2016

1.0.0-alpha.0.3

1.0.0.0-alpha0.3 https://github.com/sysvyz/brunt

PHP7 language wrapper

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

language wrapper lw

28/05 2016

1.0.0-alpha.0.2

1.0.0.0-alpha0.2 https://github.com/sysvyz/brunt

PHP7 language wrapper

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

language wrapper lw

27/05 2016

1.0.0-alpha.0.1

1.0.0.0-alpha0.1 https://github.com/sysvyz/brunt

PHP7 language wrapper

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

lr