Collection Pipelines in PHP

Leider ist der Beitrag nur auf Englisch verfügbar.

3 Replies to “Collection Pipelines in PHP”

  1. The problem with inventing new facilities is everyone ends up either making their own, or using one of many different available libraries – you end up with code that isn’t very idiomatic, you increase complexity, introduce new dependencies, add to the learning curve, etc.

    The horrible inside-out examples you show with the array_() functions of course isn’t the only possible workflow with these – you can have a linear workflow by introducing an intermediary variable, I posted an example and some quick notes here:

    1. Thank you for the example, I like it. It’s probably the best you can get with “idiomatic PHP” and I get your point of not introducing new dependencies or reinventing “foreign” concepts. For this example I cannot even argue against the temporary variable.

      It is a fine line between actual improvement and unnecessary complexity.

  2. Just to add yet another library in the mix, have a look at my enumerable lib ( ). It tries to stay close to ruby’s Enumerable module and the main difference from Knapsack is that the functionality is attached using a trait instead of a specialized class. The main benefit of that approach is that *any* class can be an Enumerable (just like in ruby).

Comments are closed.