2017 © Pedro PelĆ”ez
 

library array-manager

Mesour ArrayManager.

image

mesour/array-manager

Mesour ArrayManager.

  • Wednesday, March 9, 2016
  • by mesour
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1,598 Installations
  • PHP
  • 7 Dependents
  • 1 Suggesters
  • 3 Forks
  • 0 Open issues
  • 3 Versions
  • 2 % Grown

The README.md

Mesour ArrayManager

Searches, updates, inserts and deletes on two dimensional array, (*1)

Install

  • With Composer, (*2)

    "require": {
        "mesour/array-manager": "~0.0.2"
    }

Example array

$your_array = array(
    array('name' => 'John', 'surname' => 'Doe', 'email' => 'john.doe@test.xx'),
    array('name' => 'John', 'surname' => 'Larson', 'email' => 'peter.larson@test.xx'),
    array('name' => 'Claude', 'surname' => 'Graves', 'email' => 'claude.graves@test.xx'),
    array('name' => 'Stuart', 'surname' => 'Norman', 'email' => 'stuart.norman@test.xx'),
    array('name' => 'Kathy', 'surname' => 'Arnold', 'email' => 'kathy.arnold@test.xx'),
    array('name' => 'Jan', 'surname' => 'Wilson', 'email' => 'jan.wilson@test.xx'),
    array('name' => 'Alberta', 'surname' => 'Erickson', 'email' => 'alberta.erickson@test.xx'),
    array('name' => 'Ada', 'surname' => 'Wells', 'email' => 'ada.wells@test.xx'),
    array('name' => 'Ethel', 'surname' => 'Figueroa', 'email' => 'ethel.figueroa@test.xx'),
    array('name' => 'Ian', 'surname' => 'Goodwin', 'email' => 'ian.goodwin@test.xx'),
);

Select

$manager = new \Mesour\ArrayManager($your_array);

$select = $manager->select();

//set keys sensitive to TRUE (default is FALSE)
\Mesour\ArrayManage\Searcher\Condition::setKeysSensitive();

$select->column('*', 'name')
    ->where('name', 'John', \Mesour\ArrayManage\Searcher\Condition::EQUAL, 'or')
    ->where('name', 'Max', \Mesour\ArrayManage\Searcher\Condition::EQUAL, 'or')
    ->where('email', '.xx', \Mesour\ArrayManage\Searcher\Condition::END_WITH, 'and')
    ->limit(10)
    ->offset(1)
    ->orderBy('name', 'ASC');

print_r($select->fetchAll());

print($select->count());

Update

$manager = new \Mesour\ArrayManager($your_array);

$manager->update(array(
    'name' => 'MatouÅ”'
))
->where('name', 'John', \Mesour\ArrayManage\Searcher\Condition::EQUAL)
    ->execute();

print_r($your_array); // updated array

Insert

$manager = new \Mesour\ArrayManager($your_array);

$manager->insert(array(
    'name' => 123
))->execute();

print_r($your_array); // updated array

Delete

$manager = new \Mesour\ArrayManager($your_array);

$manager->delete()
    ->where('name', 'John', \Mesour\ArrayManage\Searcher\Condition::EQUAL)
    ->execute();

print_r($your_array); // updated array

Test

$manager = new \Mesour\ArrayManager($your_array);

$select = $manager->select();

$select->test();

The Versions

09/03 2016

dev-master

9999999-dev http://mesour.com

Mesour ArrayManager.

  Sources   Download

GPL-3.0 BSD-3-Clause

The Requires

  • php >=5.4.0

 

array array mange

09/03 2016

v3.0.0-beta

3.0.0.0-beta http://mesour.com

Mesour ArrayManager.

  Sources   Download

GPL-3.0 BSD-3-Clause

The Requires

  • php >=5.4.0

 

array array mange

11/05 2015

v0.0.1

0.0.1.0 http://mesour.com

Mesour ArrayManager.

  Sources   Download

GPL-3.0 BSD-3-Clause

The Requires

  • php >=5.4.0

 

array array mange