{"id":15578450,"url":"https://github.com/steeinru/collections","last_synced_at":"2025-10-04T08:56:43.798Z","repository":{"id":57059419,"uuid":"86724502","full_name":"SteeinRu/Collections","owner":"SteeinRu","description":"Steein Collections - Collection library for working with data.","archived":false,"fork":false,"pushed_at":"2017-05-01T19:00:09.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-29T07:42:47.378Z","etag":null,"topics":["array","collection","collections","count","json-format","library","nth","php","php7","steein-collections","union"],"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/SteeinRu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-30T16:28:28.000Z","updated_at":"2022-02-12T14:10:54.000Z","dependencies_parsed_at":"2022-08-24T14:53:28.379Z","dependency_job_id":null,"html_url":"https://github.com/SteeinRu/Collections","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/SteeinRu/Collections","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SteeinRu%2FCollections","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SteeinRu%2FCollections/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SteeinRu%2FCollections/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SteeinRu%2FCollections/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SteeinRu","download_url":"https://codeload.github.com/SteeinRu/Collections/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SteeinRu%2FCollections/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261060131,"owners_count":23103982,"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":["array","collection","collections","count","json-format","library","nth","php","php7","steein-collections","union"],"created_at":"2024-10-02T19:10:33.423Z","updated_at":"2025-10-04T08:56:38.760Z","avatar_url":"https://github.com/SteeinRu.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Steein Collections\nCollection library for working with data.\n\n## Using Collection\n\n```php\nuse Steein\\Common\\Collections\\Collection;\n\n//Generated default array\n$array = [\n    'name'      =\u003e  'Shamsudin',\n    'project'   =\u003e  'Steein',\n    'text'      =\u003e  'default text',\n\n    'Cars'  =\u003e  [\n        'car_audi' =\u003e  'Audi',\n        'car_bwm'  =\u003e  'Bmw'\n    ]\n];\n\n//Default\n$collection = new Collection($array);\n\n//Or Static implementation\n$collection = Collection::instance($array);\n\n```\n\n### Available methods and implementation methods\n\nIn this documentation we will describe the most necessary methods, and all the rest, and you can see a lot of them in the code, everything is described there\n\n***\n\nThe magic method for creating and retrieving a new item for the collection\n```php\n$collection-\u003enew_array = 'value';\n```\n\n**toArray()**\n\nGetting the collections of elements in the Array format.\n\n```php\n$collection-\u003etoArray()\n```\n\n**toJson()**\n\nGetting the collections of elements in the Json format.\n\n```php\n$collection-\u003etoJson();\n```\n\n**toXml()**\n\nGetting the collections of elements in the Json format.\n\n```php\n$collection-\u003etoXml();\n```\n\n**set()**\n\nNew item for collection\n\n```php\n$collection-\u003eset('key', 'value');\n```\n\n**get()**\n\nGet the item from the collection by key.\n\n```php\n$collection-\u003eget('key');\n```\n\n**slice()**\n\nCreate the main array of the collection.\n\n```php\n$collection-\u003eslice(1);\n```\n**nth()**\n\nCreate a new collection of each n-th attribute.\n\n```php\n$collection-\u003enth(2);\n```\n\n**union()**\n\nUnion of collections with these elements.\n\n```php\n$new_collection = Collection::instance([0 =\u003e ['a'], 1 =\u003e ['b'], 2 =\u003e ['c']]);\n$new_collection-\u003eunion([3 =\u003e ['b'], 2 =\u003e ['c']]);\n```\n\n**combine()**\n\nCreate a collection using this collection for keys, and the other for its values.\n\n```php\n$new_collection = Collection::instance(['firstname','lastname','age']);\n$new_collection-\u003ecombine(['Shamsudin','Serderov', 22]);\n```\n\n**merge()**\n\nCombine the collection with these elements.\n\n```php\n$new_collection = Collection::instance(['id_goods' =\u003e 100,'price' =\u003e 10000, 'instock' =\u003e 0]);\n$new_collection-\u003emerge(['price' =\u003e 9550, 'count' =\u003e 1]);\n```\n\n**isEmpty()**\n\nDetermine whether the collection is empty or not.\n\n```php\n$collection-\u003eisEmpty();\n```\n\n**isNotEmpty()**\n\nDetermine if the collection is empty.\n\n```php\n$collection-\u003eisNotEmpty();\n```\n\n**has()**\n\nDetermine if an element exists in the collection by key.\n\n```php\n$collection-\u003ehas('project');\n```\n\n**forget()**\n\nRemove an item from the collection by key.\n\n```php\n$collection-\u003eforget('name');\n```\n\n**archive()**\n\nArchive the collection with one or more arrays.\n\n```php\n$new_collection = Collection::instance(['test', 'test1']);\n$new_collection-\u003earchive([50, 22]);\n```\n\n**clear()**\n\nClearing Attributes in the Collection\n\n```php\n$collection-\u003eclear();\n```\n\n**count()**\n\nCount the number of items in the collection.\n\n```php\n$collection-\u003ecount()\n```\n\n**flip()**\n\nWe turn the elements into collections.\n\n```php\n\n$flip = $collection-\u003eflip();\n$flip-\u003eall();\n```\n\n**values()**\n\nGet values from items in the collection\n\n```php\n$collection-\u003evalues();\n```\n\n**keys()**\n\nGet the keys to the attributes of the collection.\n\n```php\n$collection-\u003ekeys();\n```\n\n**indexOf()**\n\nWe search for a specific value in the collection\n\n```php\n$collection-\u003eindexOf('Shamsudin');\n```\n\n**all()**\n\nGet all attributes\n\n```php\n$collection-\u003eall();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteeinru%2Fcollections","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteeinru%2Fcollections","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteeinru%2Fcollections/lists"}