Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Pack of advanced PHP array functions

License

NotificationsYou must be signed in to change notification settings

minwork/array

Repository files navigation

Build StatusCoverage StatusLatest Stable VersionGithub Stars

Pack of array convenience methods for handling:

  • Nested arrays
  • Arrays ofobjects
  • Associative arrays
  • Chaining array transformations

Easilycreate,access,validate,manipulate andtransform arrays

Advanced implementation of well known operations:

Installation

composer require minwork/array

Advantages

  • Thoroughlytested
  • Welldocumented
  • Leverages PHP 7 syntax andspeed
  • No external dependencies
  • Large variety of usages

Example of usage

// Set nested array value$array = Arr::set([],'key1.key2.key3','my_value');// Which is equivalent to['key1' => ['key2' => ['key3' =>'my_value'    ]  ]]// Get nested array valueArr::get($array,'key1.key2') -> ['key3' =>'my_value']// Check if array has nested elementArr::has($array,'key1.key2.key3') ->true// Map array while accessing it's keyArr::map($array,function ($key,$value) {// Your code here});// Find array elementArr::find($array,function ($element) {return Arr::get($element,'key2.key3') ==='my_value';}) -> ['key2' => ['key3' =>'my_value'] ]// Chain few methodsArr::obj(['test' =>1,'foo' =>'bar'])    ->set('abc',123)    ->set('[]','auto_index')    ->remove('foo')    ->getArray() ->['test' =>1,'abc' =>123,'auto_index']// Group objects by the result of calling method 'getSize' on each objectArr::groupObjects([$cat,$dog,$fish,...],'getSize') ->['medium' => [$cat,$dog,...],'small' => [$fish,...],...]

Documentation

https://minwork.gitbook.io/array/

About

Pack of advanced PHP array functions

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp