2017 © Pedro Peláez
 

library laravel-collection-normalize-keys

Laravel collection macro to ensure consistent keys within a multidimensional collection

image

amsoell/laravel-collection-normalize-keys

Laravel collection macro to ensure consistent keys within a multidimensional collection

  • Tuesday, March 13, 2018
  • by amsoell
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Laravel normalizeKeys collection method

Ensure that every array / collection within a collection contains the same keys, (*1)

$collection = collect([
  [ 'a' => 1, 'b' => 2],
  [ 'a' => 1, 'c' => 3],
  [ 'b' => 1, 'c' => 3],
]);

$collection->normalizeKeys();

// [
//     [ 'a' => 1, 'b' => 2, 'c' => null ],
//     [ 'a' => 1, 'b' => null, 'c' => 3 ],
//     [ 'a' => null, 'b' => 1, 'c' => 3 ],
// ];

Installation

composer require amsoell/laravel-collection-normalize-keys, (*2)

The Versions

13/03 2018

dev-master

9999999-dev

Laravel collection macro to ensure consistent keys within a multidimensional collection

  Sources   Download

MIT

The Requires

  • php >=5.6

 

by Andy Soell

laravel php collection macros macro

13/03 2018

v1.0

1.0.0.0

Laravel collection macro to ensure consistent keys within a multidimensional collection

  Sources   Download

MIT

The Requires

  • php >=5.6

 

by Andy Soell

laravel php collection macros macro