{"id":21074084,"url":"https://github.com/hugsbrugs/php-array","last_synced_at":"2025-10-10T17:10:02.598Z","repository":{"id":56986862,"uuid":"84848383","full_name":"hugsbrugs/php-array","owner":"hugsbrugs","description":"PHP Array Utilities","archived":false,"fork":false,"pushed_at":"2017-03-17T20:07:10.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-01T08:16:48.605Z","etag":null,"topics":["array","php","php-array"],"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/hugsbrugs.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":"2017-03-13T16:17:59.000Z","updated_at":"2017-03-15T10:37:30.000Z","dependencies_parsed_at":"2022-08-21T13:20:14.910Z","dependency_job_id":null,"html_url":"https://github.com/hugsbrugs/php-array","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/hugsbrugs/php-array","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugsbrugs%2Fphp-array","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugsbrugs%2Fphp-array/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugsbrugs%2Fphp-array/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugsbrugs%2Fphp-array/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hugsbrugs","download_url":"https://codeload.github.com/hugsbrugs/php-array/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugsbrugs%2Fphp-array/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279004815,"owners_count":26083783,"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-10T02:00:06.843Z","response_time":62,"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","php","php-array"],"created_at":"2024-11-19T19:14:24.662Z","updated_at":"2025-10-10T17:10:02.539Z","avatar_url":"https://github.com/hugsbrugs.png","language":"PHP","readme":"# php-array\n\nThis librairy provides utilities function to ease array manipulation\n\n[![Build Status](https://travis-ci.org/hugsbrugs/php-array.svg?branch=master)](https://travis-ci.org/hugsbrugs/php-array)\n[![Coverage Status](https://coveralls.io/repos/github/hugsbrugs/php-array/badge.svg?branch=master)](https://coveralls.io/github/hugsbrugs/php-array?branch=master)\n\n## Install\n\nInstall package with composer\n```\ncomposer require hugsbrugs/php-array\n```\n\nIn your PHP code, load library\n```php\nrequire_once __DIR__ . '/../vendor/autoload.php';\nuse Hug\\HArray\\HArray as HArray;\n```\nNote: I couldn't use Array as namespace because it's a PHP reserved word so it's why namespace is HArray ...\n\n## Usage\n\nShuffle an array while preserving keys\n```php\nHArray::shuffle_assoc(\u0026$array);\n```\n\nSort an array based on column filter and optional sort direction\n```php\nHArray::array_sort_by_column(\u0026$arr, $col, $dir = SORT_ASC);\n```\n\nSort a 2 dimensional array based on 1 or more indexes.\n```php\n$new_array = HArray::msort($array, $key, $sort_flags = SORT_REGULAR);\n```\n\nRecursively implodes an array with optional key inclusion\n```php\n$string = HArray::recursive_implode($glue, array $array, $include_keys = false, $trim_all = true);\n```\n\nTransforms an object (and object of object) into an array\n```php\n$new_array = HArray::object_to_array($obj);\n```\n\nCount in 2 dimensions arrays, number of rows in sub arrays\n```php\n$count = HArray::sub_count($array);\n```\n\nCuts a string into an array of strings depending of word count\n```php\n$new_array = HArray::string_to_array($text, $word_count);\n```\n\nInserts an element at a given position in an array\n```php\n$array = ['pomme', 'poire', 'fraise', 'banane'];\n$array = HArray::array_insert($array, 'kiwi', 2);\nArray\n(\n    [0] =\u003e pomme\n    [1] =\u003e poire\n    [2] =\u003e kiwi\n    [3] =\u003e fraise\n    [4] =\u003e banane\n)\n\n$array = ['pomme', 'poire', 'fraise', 'banane'];\n$array = HArray::array_insert($array, ['kiwi', 'mangue'], 2);\nArray\n(\n    [0] =\u003e pomme\n    [1] =\u003e poire\n    [2] =\u003e kiwi\n    [3] =\u003e mangue\n    [4] =\u003e fraise\n    [5] =\u003e banane\n)\n```\n\n## Unit Tests\n\n```\ncomposer exec phpunit\n```\n\n## Author\n\nHugo Maugey [visit my website ;)](https://hugo.maugey.fr)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugsbrugs%2Fphp-array","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhugsbrugs%2Fphp-array","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugsbrugs%2Fphp-array/lists"}