{"id":24669105,"url":"https://github.com/solution10/collection","last_synced_at":"2025-10-08T05:32:02.182Z","repository":{"id":18705269,"uuid":"21915705","full_name":"solution10/collection","owner":"solution10","description":"Like arrays, only better! Small, lightweight PHP 5.3 Collection class with smart slicing and fancy sorting.","archived":false,"fork":false,"pushed_at":"2014-11-29T20:24:49.000Z","size":272,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-13T18:49:23.116Z","etag":null,"topics":["arrays","composer-packages","data-structures","php"],"latest_commit_sha":null,"homepage":null,"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/solution10.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-16T20:19:42.000Z","updated_at":"2021-12-15T18:50:50.000Z","dependencies_parsed_at":"2022-09-25T01:52:00.926Z","dependency_job_id":null,"html_url":"https://github.com/solution10/collection","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/solution10/collection","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solution10%2Fcollection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solution10%2Fcollection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solution10%2Fcollection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solution10%2Fcollection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/solution10","download_url":"https://codeload.github.com/solution10/collection/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solution10%2Fcollection/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278892192,"owners_count":26063946,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["arrays","composer-packages","data-structures","php"],"created_at":"2025-01-26T09:19:35.328Z","updated_at":"2025-10-08T05:32:01.837Z","avatar_url":"https://github.com/solution10.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Solution10\\Collection\n\nLike Arrays. Only better!\n\n[![Build Status](https://travis-ci.org/Solution10/collection.svg?branch=master)](https://travis-ci.org/Solution10/collection)\n[![Coverage Status](https://coveralls.io/repos/Solution10/collection/badge.png)](https://coveralls.io/r/Solution10/collection)\n\n[![Latest Stable Version](https://poser.pugx.org/solution10/collection/v/stable.svg)](https://packagist.org/packages/solution10/collection)\n[![Total Downloads](https://poser.pugx.org/solution10/collection/downloads.svg)](https://packagist.org/packages/solution10/collection)\n[![Latest Unstable Version](https://poser.pugx.org/solution10/collection/v/unstable.svg)](https://packagist.org/packages/solution10/collection)\n[![License](https://poser.pugx.org/solution10/collection/license.svg)](https://packagist.org/packages/solution10/collection)\n\n## What does this do?\n\nCollections, at their core, are implementations of Iterator, ArrayAccess and Countable. But they're also a lot more than that.\n\nSplice subsections of arrays simply by passing keys:\n\n```php\n$collection = new Collection(array('Apple', 'Orange', 'Banana'));\n$subset = $collection['0:1'];\n// $subset is now: array('Apple', 'Orange')\n\n$collection = new Collection(array('Apple', 'Orange', 'Banana'));\n$subset = $collection['-2:2'];\n// $subset contains ('Orange', 'Banana')\n\n$collection = new Collection(array('Apple', 'Orange', 'Banana', 'Grapes'));\n$subset = $collection[':LAST'];\n// $subset is simply array('Grapes')\n```\n\nQuickly and easily Sort\n\n```php\n$collection = new Collection(array(100, 50, 70, 10));\n$collection-\u003esort(Collection::SORT_ASC);\n// $collection's order is now: 10, 50, 70, 100\n\n$collection = new Collection(array(\n    array(\n        'name' =\u003e 'Sarah',\n        'job' =\u003e 'Manager',\n    ),\n    array(\n        'name' =\u003e 'Alex',\n        'job' =\u003e 'Developer',\n    ),\n    array(\n        'name' =\u003e 'Tracy',\n        'job' =\u003e 'HR'\n    ),\n));\n$collection-\u003esortByMember('name', Collection::SORT_ASC);\n```\n\nFor full feature list, [check out the docs](http://github.com/Solution10/collection/wiki).\n\n## Installation\n\nInstall via composer:\n\n```json\n\"require\": {\n    \"solution10/collection\": \"1.*\"\n}\n```\n\n## Requirements\n\n- PHP \u003e= 5.3\n\nThat's it!\n\n## Documentation\n\nSee the [Github Wiki](http://github.com/Solution10/collection/wiki)\nor the [docs/ folder in the repo](http://github.com/solution10/collection/tree/master/docs).\n\nTo get api docs; from a checkout of the project run:\n\n    $ make \u0026\u0026 open api/index.html\n\n## License\n\n[MIT](http://github.com/solution10/collection/tree/master/LICENSE.md)\n\n## Contributing\n\n[Contributors Notes](http://github.com/solution10/collection/tree/master/CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolution10%2Fcollection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolution10%2Fcollection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolution10%2Fcollection/lists"}