{"id":31871629,"url":"https://github.com/syaiful6/headbanger","last_synced_at":"2025-10-12T20:28:55.936Z","repository":{"id":57063453,"uuid":"57256847","full_name":"syaiful6/headbanger","owner":"syaiful6","description":"Headbanger! PHP Data structure","archived":false,"fork":false,"pushed_at":"2016-05-30T08:59:19.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-18T09:59:05.480Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/syaiful6.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-28T00:03:22.000Z","updated_at":"2016-04-28T00:04:37.000Z","dependencies_parsed_at":"2022-08-24T14:01:03.530Z","dependency_job_id":null,"html_url":"https://github.com/syaiful6/headbanger","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/syaiful6/headbanger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syaiful6%2Fheadbanger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syaiful6%2Fheadbanger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syaiful6%2Fheadbanger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syaiful6%2Fheadbanger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syaiful6","download_url":"https://codeload.github.com/syaiful6/headbanger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syaiful6%2Fheadbanger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279012800,"owners_count":26085187,"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-12T02:00:06.719Z","response_time":53,"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":[],"created_at":"2025-10-12T20:28:55.137Z","updated_at":"2025-10-12T20:28:55.921Z","avatar_url":"https://github.com/syaiful6.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Headbanger\n\nPHP data structure and or collections.\n\nMotivation: PHP only give us array and object as compound type. There are no list,\nhash table, set, etc. Array on PHP doest it all. This make operation on array not predictable, is sometimes act as ordered set, list, ordered map.\nThis package aim to provide some basic data structure to cover this gap.\n\n### Install\n\n```composer require syaiful6/headbanger```\n\nThis package contains implementations of Map, List, Set and Str. We consider string\nas container, because it can be accessed via array notation and when we want\nto iterate string, we actually want to iterate over character.\n\n### Map\n\nPython call this dict, Ruby call this type Hash. Whatever the name, this data\ntype can 'map' key value pair. Typically the key are unique (within one map).\n\nThe main operations on a map are storing a value with some key and extracting\nthe value given the key. It's also should possible to delete a key-value pair\nfor the given key.\n\nThis package provide one implementation for this data type. ```HashMap``` that\nalso implements Countable, Traversable and ArrayAccess. So you can treat this\ninstance as array. To delete key-value pair use ```unset($hash['somekey'])```\n\nNote: ```HashMap``` is unordered map and not permit adding item during iteration,\nreplacing a key-value is fine. Iterate over map will give you the key only, with\nthis key you can access the value anyway. If you need the value use ```values``` method,\nif you need both use ```items`` method.\n\n```\n$map = new Headbanger\\HashMap();\n// Add item, or just give map your array or any traversable on constructor\n$map['one'] = 1;\n$map['two'] = 2;\n$map['three'] = 3;\n// deleting\nunset($map['one']);\n// check if item exists\nisset($map['one']);\n```\n\n### List\n\nA list or sequence, represents an ordered sequence of values, these values may\noccur more than once within on list. Think of it as finite sequence. Currently\nonly one implementation provided: ArrayList. Using SplFixedArray as their storage.\n\nYou can use ArrayList as ```Stack```, where the last element added is the first\nelement retrieved (“last-in, first-out”). Use ```push``` to add item, and retrieve\nan item from the top use ```pop``` (without argument). However dont use ArrayList\nas Queue, they are not efficient for this purpose. But it possible.\n\n### Set\n\nA set is an unordered collection with no duplicate elements. The common operations\nare remove duplicates entries and membership testing. Set also support mathematical\noperations like union, intersection, difference, etc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyaiful6%2Fheadbanger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyaiful6%2Fheadbanger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyaiful6%2Fheadbanger/lists"}