2017 © Pedro Peláez
 

library array-access

PHP multi array access

image

petrgrishin/array-access

PHP multi array access

  • Tuesday, March 29, 2016
  • by petrgrishin
  • Repository
  • 4 Watchers
  • 23 Stars
  • 1,639 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 9 Versions
  • 2 % Grown

The README.md

array-access

Travis CI Coverage Status Latest Stable Version Total Downloads License, (*1)

PHP multi array access, (*2)

Installation

Add a dependency to your project's composer.json file if you use Composer to manage the dependencies of your project:, (*3)

{
    "require": {
        "petrgrishin/array-access": "~2.0"
    }
}

Usage examples

Basic usage array-access objects

use \PetrGrishin\ArrayAccess\ArrayAccess;

$arrayParams = array(
    'a' => array(
        'b' => 10,
    )
);
$params = ArrayAccess::create($arrayParams);
$value = $params->getValue('a.b');
$params
    ->setValue('a.b', 20)
    ->setValue('a.c', 30);
$params->remove('a.b');
$resultArrayParams = $params->getArray();
// array(
//     'a' => array(
//         'c' => 30,
//     )
// )

Use ArrayMap

$arrayAccess = ArrayAccess::create($array);
$arrayAccess->getMap()
    ->filter($callback)
    ->map($callback)
    ->userSortByValue($callback)
    ->userSortByKey($callback)
    ->mergeWith($array)
    ->replaceWith($array);
$resultArrayParams = $arrayAccess->getArray();

Example of usage ArrayMap class — https://github.com/petrgrishin/array-map, (*4)

Example of usage in Yii2 behavior

https://github.com/petrgrishin/yii2-array-field, (*5)

The Versions

29/03 2016

dev-master

9999999-dev

PHP multi array access

  Sources   Download

MIT

The Requires

 

The Development Requires

by Petr Grishin

15/07 2014

2.2.0

2.2.0.0

PHP multi array access

  Sources   Download

MIT

The Requires

 

The Development Requires

by Petr Grishin

10/07 2014

2.1.1

2.1.1.0

PHP multi array access

  Sources   Download

MIT

The Requires

 

The Development Requires

by Petr Grishin

26/06 2014

2.1.0

2.1.0.0

PHP multi array access

  Sources   Download

MIT

The Requires

 

The Development Requires

by Petr Grishin

26/06 2014

2.0.0

2.0.0.0

PHP multi array access

  Sources   Download

MIT

The Requires

 

The Development Requires

by Petr Grishin

20/06 2014

1.2.0

1.2.0.0

PHP multi array access

  Sources   Download

MIT

The Requires

 

The Development Requires

by Petr Grishin

01/06 2014

1.1.1

1.1.1.0

PHP multi array access

  Sources   Download

MIT

The Requires

 

The Development Requires

by Petr Grishin

07/05 2014

1.1.0

1.1.0.0

PHP multi array access

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Petr Grishin

04/05 2014

1.0.0

1.0.0.0

PHP multi array access

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Petr Grishin