2017 © Pedro Peláez
 

utilities utilities

Utilities for PHP 7.1^

image

chris-kruining/utilities

Utilities for PHP 7.1^

  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 25 Versions
  • 1 % Grown

The README.md

Latest Stable Version Latest Unstable Version License Maintainability Test Coverage SensioLabsInsight, (*1)

Utilities

some utilities for php, nothing special, nothing new, just to my taste, (*2)

Installation

installation is simply done via composer composer require chris-kruining/utilities, (*3)

Usage

The main component of the library is the Collection at the moment. The goal of the Collection is to provide a object oriented interface for array functions. It also has a couple of extra's like method chaining and linq-esc implementation(NOT DONE YET) so that you may interact with the Collection as if it was a database table, (*4)

for example, (*5)

CPB\Utilities\Collections\Collection::from([ 'these', 'are', null, null, 'some', null, 'test', 'values', null ])
  ->filter()
  ->toString(' ');

would yield, (*6)

'these are some test values'

which is the same as, (*7)

join(' ', array_filter([ 'these', 'are', null, null, 'some', null, 'test', 'values', null ]));

I agree, the vannilla way is shorter now but the strength really comes into play when we start adding callbacks and increase the chain length, (*8)

CPB\Utilities\Collections\Collection::from([ 'these', '', '', 'are', null, 'some', null, 'test', '', 'values', '' ])
  ->filter(fn($v) => $v !== null && strlen($v) > 0)
  ->map(fn($k, $v) => $k . '::' . $v)
  ->toString('|');

would yield, (*9)

'0::these|1::are|2::some|3::test|4::values'

which is the same as, (*10)

$filtered = array_filter(
  [ 'these', '', '', 'are', null, 'some', null, 'test', '', 'values', '' ], 
  fn($v) => $v !== null && strlen($v) > 0
);

join('|', array_map(fn($k, $v) => $k . '::' . $v, array_keys($filtered), $filtered));

As you can see the collection version maintains readability whereas the vannilla version loses in my opinion it's charm because to achieve a single goal you need to spread it out over multiple variables, (*11)

Roadmap

  • [X] Implement basic features to Collection
  • [X] Bloat Collection with features :P
  • [X] Split of features into an inheritance tree
  • [X] Split lazy mode from Collection into LazyCollection and implement PHP's array functions as generators
  • [ ] Finish inheritance structure
  • [ ] Implement LazyCollection
  • [X] (Better) implement the Queryable interface in a new class so the Collection doesn't become bloated

The Versions

04/06 2018

dev-master

9999999-dev https://github.com/chris-kruining/utilities

Utilities for PHP 7.1^

  Sources   Download

GPL-3.0 GPL-3.0-or-later

The Requires

 

The Development Requires

php utilities

04/06 2018
23/05 2018
14/05 2018
02/05 2018
26/04 2018

0.2.5

0.2.5.0 https://github.com/chris-kruining/utilities

Utilities for PHP 7.1^

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

php utilities

09/04 2018

0.2.4

0.2.4.0 https://github.com/chris-kruining/utilities

Utilities for PHP 7.1^

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

php utilities

15/03 2018

0.2.3

0.2.3.0 https://github.com/chris-kruining/utilities

Utilities for PHP 7.1^

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

php utilities

08/03 2018

0.2.2

0.2.2.0 https://github.com/chris-kruining/utilities

Utilities for PHP 7.1^

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

php utilities

27/02 2018

0.2.1

0.2.1.0 https://github.com/chris-kruining/utilities

Utilities for PHP 7.1^

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

php utilities

01/02 2018

0.2.0

0.2.0.0 https://github.com/chris-kruining/utilities

Utilities for PHP 7.1^

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

php utilities

02/11 2017

0.1.12

0.1.12.0 https://github.com/chris-kruining/utilities

Utilities for PHP 7.1^

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

php utilities

02/11 2017

0.1.11

0.1.11.0 https://github.com/chris-kruining/utilities

Utilities for PHP 7.1^

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

php utilities

01/11 2017

0.1.10

0.1.10.0 https://github.com/chris-kruining/utilities

Utilities for PHP 7.1^

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

php utilities

01/11 2017

0.1.9

0.1.9.0 https://github.com/chris-kruining/utilities

Utilities for PHP 7.1^

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

php utilities

01/11 2017

0.1.8

0.1.8.0 https://github.com/chris-kruining/utilities

Utilities for PHP 7.1^

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

php utilities

30/10 2017

0.1.7

0.1.7.0 https://github.com/chris-kruining/utilities

Utilities for PHP 7.1^

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

php utilities

30/10 2017

0.1.6

0.1.6.0 https://github.com/chris-kruining/utilities

Utilities for PHP 7.1^

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

php utilities

30/10 2017

0.1.5

0.1.5.0 https://github.com/chris-kruining/utilities

Utilities for PHP 7.1^

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

php utilities

30/10 2017

0.1.4

0.1.4.0 https://github.com/chris-kruining/utilities

Utilities for PHP 7.1^

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

php utilities

27/10 2017

0.1.3

0.1.3.0 https://github.com/chris-kruining/utilities

Utilities for PHP 7.1^

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

php utilities

19/10 2017

0.1.2

0.1.2.0 https://github.com/chris-kruining/utilities

Utilities for PHP 7.1^

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

php utilities

19/10 2017

0.1.1

0.1.1.0 https://github.com/chris-kruining/utilities

Utilities for PHP 7.1^

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

php utilities

18/10 2017

0.1.0

0.1.0.0 https://github.com/chris-kruining/utilities

Utilities for PHP 7.1^

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

php utilities

14/07 2017

0.0.1

0.0.1.0 https://github.com/chris-kruining/utilities

Utilities for PHP 7^

  Sources   Download

GPL-3.0

The Requires

  • php >=7.0.0

 

The Development Requires

php utilities