All Projects → petrgrishin → array-access

petrgrishin / array-access

Licence: other
PHP multi array access

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to array-access

yii2-multi-select-widget
Bootstrap MultiSelect and MultiSelect Listbox widgets for Yii2
Stars: ✭ 45 (+95.65%)
Mutual labels:  yii2, yii
yii2-presenter
Yii2 View Presenter
Stars: ✭ 13 (-43.48%)
Mutual labels:  yii2, yii
yii2-faker
Yii 2 Faker extension
Stars: ✭ 99 (+330.43%)
Mutual labels:  yii2, yii
yii2-dingtalk
yii2钉钉接口
Stars: ✭ 23 (+0%)
Mutual labels:  yii2, yii
yii2-starter-kit-lite
Yii2 Starter kit for begin your application
Stars: ✭ 41 (+78.26%)
Mutual labels:  yii2, yii
yii2-formbuilder
A drag and drop form builder with jQuery for Yii2
Stars: ✭ 33 (+43.48%)
Mutual labels:  yii2, yii
ar-role
ActiveRecord behavior, which provides relation roles (table inheritance)
Stars: ✭ 34 (+47.83%)
Mutual labels:  yii2, yii
content
Content management system for Yii2
Stars: ✭ 54 (+134.78%)
Mutual labels:  yii2, yii
ar-dynattribute
Provide ActiveRecord dynamic attributes stored into the single field in serialized state
Stars: ✭ 43 (+86.96%)
Mutual labels:  yii2, yii
yii2-composer
Yii 2 composer extension
Stars: ✭ 76 (+230.43%)
Mutual labels:  yii2, yii
behavior-trait
Allows handling events via inline declared methods, which can be added by traits
Stars: ✭ 18 (-21.74%)
Mutual labels:  yii2, yii
awesome-yii2
Curated list of resources about using Yii2 - Yii is a high-performance component-based PHP framework.
Stars: ✭ 36 (+56.52%)
Mutual labels:  yii2, yii
ar-search
Provides unified search model for Yii ActiveRecord
Stars: ✭ 31 (+34.78%)
Mutual labels:  yii2, yii
slides
Alexander Makarov conference slides
Stars: ✭ 26 (+13.04%)
Mutual labels:  yii2, yii
yii2-notifications
This Yii2 extension provides support for sending notifications across a variety of delivery channels, including mail, SMS, Slack, Telegram etc.
Stars: ✭ 62 (+169.57%)
Mutual labels:  yii2, yii
project-template
Yii2 Project Template
Stars: ✭ 53 (+130.43%)
Mutual labels:  yii2, yii
yii2-admin-theme
基于Yii2+layui的后台框架模板,实现了完善的RBAC权限控制
Stars: ✭ 87 (+278.26%)
Mutual labels:  yii2, yii
yii2-grid-view-library
Highly enhanced GridView widget and grid components for Yii2
Stars: ✭ 57 (+147.83%)
Mutual labels:  yii2, yii
ar-variation
Variation behavior for ActiveRecord
Stars: ✭ 46 (+100%)
Mutual labels:  yii2, yii
filedb
ActiveRecord for static data definitions based on files
Stars: ✭ 72 (+213.04%)
Mutual labels:  yii2, yii

array-access

Travis CI Coverage Status Latest Stable Version Total Downloads License

PHP multi array access

Installation

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

{
    "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

Example of usage in Yii2 behavior

https://github.com/petrgrishin/yii2-array-field

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].