{"id":21216884,"url":"https://github.com/lablnet/dshandler","last_synced_at":"2025-10-09T01:12:07.058Z","repository":{"id":57010516,"uuid":"235648848","full_name":"lablnet/DSHandler","owner":"lablnet","description":"PHP DSHandler can manipulate data structures","archived":false,"fork":false,"pushed_at":"2020-01-22T19:35:32.000Z","size":6,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-09T01:07:55.269Z","etag":null,"topics":["array","classs","data","data-structure","dshandler","element","free","handler","handlers","mit","open-source","php","remove","sort","unique"],"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/lablnet.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":"2020-01-22T19:24:59.000Z","updated_at":"2023-09-08T18:02:35.000Z","dependencies_parsed_at":"2022-08-21T15:10:21.394Z","dependency_job_id":null,"html_url":"https://github.com/lablnet/DSHandler","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lablnet/DSHandler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lablnet%2FDSHandler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lablnet%2FDSHandler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lablnet%2FDSHandler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lablnet%2FDSHandler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lablnet","download_url":"https://codeload.github.com/lablnet/DSHandler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lablnet%2FDSHandler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000722,"owners_count":26082894,"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":["array","classs","data","data-structure","dshandler","element","free","handler","handlers","mit","open-source","php","remove","sort","unique"],"created_at":"2024-11-20T21:56:08.225Z","updated_at":"2025-10-09T01:12:07.017Z","avatar_url":"https://github.com/lablnet.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP DataStructure Handler\n##### This package can manipulate data structures.\n\n## Requirement\n1. PHP\n2. Composer\n\n## Installation\nInstalling this package is very simple, first ensure you have the right PHP version and composer installed then in your terminal/(command prompt) run:  `composer require lablnet/dshandler:dev-master`\n\n## Feature\n\n 1. Sort multi dimessional array based on column.\n 2. Remove  duplicate array base on key\n 3. Remove array, base on key:value pair.\n \n ## TODO\n [ ] Allow to specificy range on remove array:\n\t - Like we should able to say, remove products below rating 3...\n \n\n\n## Usage\nConsider the following dataset\n```php\n$products = [\n\t[\n\t\t'id' =\u003e 1,\n\t\t'name' =\u003e 'Test 1',\n\t\t'price' =\u003e 300,\n\t\t'rating' =\u003e 4.5\n\t],\n\t[\n\t\t'id' =\u003e 2,\n\t\t'name' =\u003e 'Test 2',\n\t\t'price' =\u003e 600,\n\t\t'rating' =\u003e 4.1\n\t],\n\t[\n\t\t'id' =\u003e 3,\n\t\t'name' =\u003e 'Test 3',\n\t\t'price' =\u003e 150,\n\t\t'rating' =\u003e 3.1\n\t],\n\t[\n\t\t'id' =\u003e 4,\n\t\t'name' =\u003e 'Test 4',\n\t\t'price' =\u003e 700,\n\t\t'rating' =\u003e 5\n\t],\n\t[\n\t\t'id' =\u003e 5,\n\t\t'name' =\u003e 'Test 5',\n\t\t'price' =\u003e 900,\n\t\t'rating' =\u003e 2.9\n\t],\n\t[\n\t\t'id' =\u003e 6,\n\t\t'name' =\u003e 'Test 5',\n\t\t'price' =\u003e 265,\n\t\t'rating' =\u003e 2.9\n\t]\n];\n```\n\nInitialise the classs\n```php\nrequire_once \"../vendor/autoload.php\";\n\n$handler = new Lablnet\\DSHandler();\n```\n\n1. Remove array/products by key:value\n```php\n//remove array by key:value\n$handler-\u003e_remove($products, 'rating', 2.9);\necho \"\u003ch3\u003eRemove array by key:value\u003c/h3\u003e\u003cpre\u003e\";\nprint_r($products);\necho \"\u003c/pre\u003e\";\necho \"\u003cbr\u003e\";\n```\n2. Remove duplicate array by key\n```php\n//remove duplicate array by key\n$unique = $handler-\u003e_unique($products, 'name');\necho \"\u003ch3\u003eRemove duplicate value by key\u003c/h3\u003e\u003cpre\u003e\";\nprint_r($unique);\necho \"\u003c/pre\u003e\";\necho \"\u003cbr\u003e\";\n```\n3. Sort the products base on price\n```php\n//Now sort the products base on price\n$sort_1_price = $products;\n$handler-\u003e_sort($sort_1_price, 'price', SORT_ASC);\necho \"\u003ch3\u003eSort by price ASC\u003c/h3\u003e\u003cpre\u003e\";\nprint_r($sort_1_price);\necho \"\u003c/pre\u003e\";\necho \"\u003cbr\u003e\";\n$sort_2_price = $products;\n$handler-\u003e_sort($sort_2_price, 'price', SORT_DESC);\necho \"\u003ch3\u003eSort by price DESC\u003c/h3\u003e\u003cpre\u003e\";\nprint_r($sort_2_price);\necho \"\u003c/pre\u003e\";\necho \"\u003cbr\u003e\";\n```\n4. Sort the products based on rating\n```php\n//Now sort the product base on rating\n$sort_1_rating = $products;\n$handler-\u003e_sort($sort_1_rating, 'rating', SORT_ASC);\necho \"\u003ch3\u003eSort by Rating ASC\u003c/h3\u003e\u003cpre\u003e\";\nprint_r($sort_1_rating);\necho \"\u003c/pre\u003e\";\necho \"\u003cbr\u003e\";\n$sort_2_rating = $products;\n$handler-\u003e_sort($sort_2_rating, 'rating', SORT_DESC);\necho \"\u003ch3\u003eSort by Rating DESC\u003c/h3\u003e\u003cpre\u003e\";\nprint_r($sort_2_rating);\necho \"\u003c/pre\u003e\";\necho \"\u003cbr\u003e\";\n```\n\n## Example\nThe example file is distrubuted with this package.\n\n## License\n\nThis package is open-sourced software licensed under the  [MIT license](https://opensource.org/licenses/MIT).\n\n## Questions\nIf you have any question feel free to ask me\n\n[https://www.linkedin.com/in/lablnet/](https://www.linkedin.com/in/lablnet/)\n[https://lablnet.github.io/profile](https://lablnet.github.io/profile)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flablnet%2Fdshandler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flablnet%2Fdshandler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flablnet%2Fdshandler/lists"}