2017 © Pedro Peláez
 

library collection

Simple PHP Collection based on Laravel 5 Collection

image

roquie/collection

Simple PHP Collection based on Laravel 5 Collection

  • Friday, March 10, 2017
  • by Roquie
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1,241 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 13 Versions
  • 0 % Grown

The README.md

Collection

DEPRECATED. Please, use original laravel collection. This package no longer maintained., (*1)

Simple PHP Collection based on Laravel 5 Collection., (*2)

Install

composer require roquie/collection, (*3)

Usage (in progress ...)

Five minutes example:
, (*4)

$array = [
    'foo' => [
        'one',
        'two',
        'three',
        'bar' => [
            1, 2, 3
        ],
        'clean' => '',
        'test1' => 'val2qq',
        'test2' => 'val2ww'
    ]
];

$collection = Collection::make($array);
//1
foreach($collection as $collect) {
    echo $collect['undefined_index']; // null
}

//2 

$result = $collection->each(function($collect) {
    echo $collect['undefined_index']; // null
});

//3

$result = $collection->filter(function($collect) {
    return $collect->has('key'); 
});


//4. get items using "dot" notation
$collection->get('foo.0', <default>);
$collection->getArray('foo.0'); // return [] if empty
$collection->getInteger('foo.0'); // return 0 if empty
$collection->getBoolean('foo.0'); // return false if empty
$collection->getString('foo.0'); // return '' if empty


//5. remove item using "dot" notation
$collection->rm('foo.bar'); // delete an item


//6. has item using "dot" notation
$collection->rm('foo.bar'); // true (if not delete :) )
$collection->forgot('foo.bar'); //alias

//7. clean array

$collection->clean(); // key foo.clean deleted.
$collection->clean('val'); // keys foo.test1 and 2 will be removed

//8. set an item using "dot" notation

$collection->set('baz', ['key' => 'is awesome']);
$collection->put($key, $value); //alias


License

MIT, (*5)

The Versions

10/03 2017

dev-master

9999999-dev

Simple PHP Collection based on Laravel 5 Collection

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Avatar Roquie

laravel collection roquie

11/12 2015

0.1.11

0.1.11.0

Simple PHP Collection based on Laravel 5 Collection

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Avatar Roquie

laravel collection roquie

18/08 2015

0.1.10

0.1.10.0

Simple PHP Collection based on Laravel 5 Collection

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Avatar Roquie

laravel collection roquie

13/08 2015

0.1.9

0.1.9.0

Simple PHP Collection based on Laravel 5 Collection

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Avatar Roquie

laravel collection roquie

12/08 2015

0.1.8

0.1.8.0

Simple PHP Collection based on Laravel 5 Collection

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Avatar Roquie

laravel collection roquie

12/08 2015

0.1.7

0.1.7.0

Simple PHP Collection based on Laravel 5 Collection

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Avatar Roquie

laravel collection roquie

04/08 2015

0.1.6

0.1.6.0

Simple PHP Collection based on Laravel 5 Collection

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Avatar Roquie

laravel collection roquie

24/06 2015

0.1.5

0.1.5.0

Simple PHP Collection based on Laravel 5 Collection

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Avatar Roquie

laravel collection roquie

24/06 2015

0.1.4

0.1.4.0

Simple PHP Collection based on Laravel 5 Collection

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Avatar Roquie

laravel collection roquie

21/06 2015

0.1.3

0.1.3.0

Simple PHP Collection based on Laravel 5 Collection

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Avatar Roquie

laravel collection roquie

21/06 2015

0.1.2

0.1.2.0

Simple PHP Collection based on Laravel 5 Collection

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Avatar Roquie

laravel collection roquie

20/06 2015

0.1.1

0.1.1.0

Simple PHP Collection based on Laravel 5 Collection

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Avatar Roquie

laravel collection roquie

20/06 2015

0.1.0

0.1.0.0

Simple PHP Collection based on Laravel 5 Collection

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Avatar Roquie