{"id":20911578,"url":"https://github.com/bluzphp/collection","last_synced_at":"2025-12-24T17:29:35.909Z","repository":{"id":45221944,"uuid":"189393408","full_name":"bluzphp/collection","owner":"bluzphp","description":"Collection Package","archived":false,"fork":false,"pushed_at":"2023-11-08T13:28:44.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-26T23:03:25.629Z","etag":null,"topics":["bluz-package","php","php-library"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bluzphp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-30T10:24:18.000Z","updated_at":"2022-07-17T08:54:55.000Z","dependencies_parsed_at":"2024-09-10T11:48:39.961Z","dependency_job_id":null,"html_url":"https://github.com/bluzphp/collection","commit_stats":{"total_commits":19,"total_committers":3,"mean_commits":6.333333333333333,"dds":0.368421052631579,"last_synced_commit":"efa06048eb2f432a044ac14504577e999d4c624b"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluzphp%2Fcollection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluzphp%2Fcollection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluzphp%2Fcollection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluzphp%2Fcollection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bluzphp","download_url":"https://codeload.github.com/bluzphp/collection/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243302077,"owners_count":20269450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bluz-package","php","php-library"],"created_at":"2024-11-18T14:22:35.547Z","updated_at":"2025-12-24T17:29:35.859Z","avatar_url":"https://github.com/bluzphp.png","language":"PHP","readme":"# Collection Component\n## Achievements\n\n[![PHP \u003e= 8.2+](https://img.shields.io/packagist/php-v/bluzphp/collection.svg?style=flat)](https://php.net/)\n\n[![Latest Stable Version](https://img.shields.io/packagist/v/bluzphp/collection.svg?label=version\u0026style=flat)](https://packagist.org/packages/bluzphp/collection)\n\n[![Build Status](https://img.shields.io/scrutinizer/build/g/bluzphp/collection)](https://scrutinizer-ci.com/g/bluzphp/collection/build-status/master)\n\n[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/bluzphp/collection.svg?style=flat)](https://scrutinizer-ci.com/g/bluzphp/collection/)\n\n[![Total Downloads](https://img.shields.io/packagist/dt/bluzphp/collection.svg?style=flat)](https://packagist.org/packages/bluzphp/collection)\n\n[![License](https://img.shields.io/packagist/l/bluzphp/collection.svg?style=flat)](https://packagist.org/packages/bluzphp/collection)\n\n## Usage\n\nExample of an array:\n```php\n$arr = [\n    'a', \n    'b' =\u003e 'boo',\n    'c' =\u003e [\n        'c1',\n        'c2',\n        'c3'\n    ],\n    'd' =\u003e [\n        'd1' =\u003e ['d1.1', 'd1.2'],\n        'd2' =\u003e ['d2.1', 'd2.2'],\n        'd3' =\u003e ['d3.1', 'd3.2'],\n    ],\n    'e' =\u003e null,\n    'f' =\u003e false\n];\n```\n\n### Check the element by key(s) \n\nUsage:\n```php\nCollection::has(array $array, ...$keys);\narray_has($array, ...$keys);\n```\n\nExamples:\n```php\narray_has($array, 0);         // true \narray_has($array, 'b');       // true\narray_has($array, 'c', 0);    // true\narray_has($array, 'd', 'd1'); // true\narray_has($array, 'e');       // true\narray_has($array, 'f');       // true\narray_has($array, 'g');       // false\n```\n\nCompare to `isset()`:\n```php\nisset($array['e']); // false\n```\n\n### Get the element by key(s) \n\nUsage:\n```php\nCollection::get(array $array, ...$keys);\narray_get(array $array, ...$keys);\n```\n\nExamples:\n```php\narray_get($array, 0);         // 'a' \narray_get($array, 'b');       // 'boo'\narray_get($array, 'c', 0);    // 'c1'\narray_get($array, 'd', 'd1'); // ['d1.1', 'd1.2']\narray_get($array, 'e');       // null\narray_get($array, 'e', 'e');  // null\n```\n\n### Add the element to the array by key(s) \n\nUsage:\n```php\nCollection::add(array \u0026$array, $key, ...$values);\narray_add(array \u0026$array, $key, ...$values);\n```\n\nExamples:\n```php\narray_add($array, 'c', 'c3');           // $array['c'][] = 'c3'\narray_add($array, 'd', 'd1', 'd1.3');   // $array['d']['d1'][] = 'd1.3'\narray_add($array, 'g', 'g1', 'g1.1');   // $array['g']['g1'][] = 'g1.1'\n\n// but\narray_add($array, 'b', 'b1');           // InvalidArgumentException - $array['b'] is not an array\n```\n\n### Set the element of the array by key(s)\n\nThis method is similar to native way.\n\nUsage:\n```php\nCollection::set(array \u0026$array, $key, ...$values);\narray_set(array \u0026$array, $key, ...$values);\n```\n\nExamples:\n```php\narray_set($array, 'g', 'game over');       // $array['g'] = 'game over';\narray_set($array, 'h', 'high way', 'e95'); // $array['h']['high way'] = 'e95';\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluzphp%2Fcollection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbluzphp%2Fcollection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluzphp%2Fcollection/lists"}