{"id":23130488,"url":"https://github.com/marcmascarell/arrayer","last_synced_at":"2025-06-15T03:08:52.862Z","repository":{"id":23626997,"uuid":"26996622","full_name":"marcmascarell/arrayer","owner":"marcmascarell","description":"Array manipulation. Get, set \u0026 delete keys with dot notation, also prepares an array to be put in a file (php array or json).","archived":false,"fork":false,"pushed_at":"2017-02-11T11:18:01.000Z","size":26,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-05T02:41:23.269Z","etag":null,"topics":["array-manipulations","dot-notation","php-array"],"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/marcmascarell.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":"2014-11-22T11:13:44.000Z","updated_at":"2020-12-18T20:17:01.000Z","dependencies_parsed_at":"2022-08-22T02:50:15.800Z","dependency_job_id":null,"html_url":"https://github.com/marcmascarell/arrayer","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/marcmascarell/arrayer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcmascarell%2Farrayer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcmascarell%2Farrayer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcmascarell%2Farrayer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcmascarell%2Farrayer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcmascarell","download_url":"https://codeload.github.com/marcmascarell/arrayer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcmascarell%2Farrayer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259914924,"owners_count":22931329,"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-manipulations","dot-notation","php-array"],"created_at":"2024-12-17T10:14:29.498Z","updated_at":"2025-06-15T03:08:52.826Z","avatar_url":"https://github.com/marcmascarell.png","language":"PHP","readme":"Arrayer\n=========\n\n[![Packagist](https://img.shields.io/packagist/v/mascame/arrayer.svg?maxAge=2592000?style=plastic)](https://packagist.org/packages/mascame/arrayer)\n[![Travis](https://img.shields.io/travis/marcmascarell/arrayer.svg?maxAge=2592000?style=plastic)](https://travis-ci.org/marcmascarell/arrayer)\n[![license](https://img.shields.io/github/license/marcmascarell/arrayer.svg?maxAge=2592000?style=plastic)](https://github.com/marcmascarell/arrayer)\n\nArray manipulation. Get, set \u0026 delete keys with dot notation, also prepares an array to be put in a file (php array or json).\n\nInstallation\n--------------\n\nRequire this package in your composer.json and run composer update:\n\n`composer require mascame/arrayer`\n\n\nUsage\n--------------\n\n```php\n\n$array = array(\n\n\t'this' =\u003e array(\n\t\t'is' =\u003e 'an',\n\t\t'example'\n\t),\n\n\t'we use a' =\u003e 'normal array',\n\n\t'and manipulate it' =\u003e array(\n\t\t'as' =\u003e array(\n\t\t\t'we' =\u003e array(\n\t\t\t\t'want' =\u003e ':D'\n\t\t\t)\n\t\t)\n\t),\n\n\t'thats it',\n\t'cool? :)'\n\n);\n\n$arrayer = new \\Mascame\\Arrayer\\Arrayer($array);\n\n$arrayer-\u003eset('we.use.dot.notation', array('so', 'cool.'));\n\n$arrayer-\u003eset('this.is', 'we gonna delete this very soon...');\n$arrayer-\u003edelete('this.is');\n\n$arrayer-\u003eset('more.examples', 'test');\n$arrayer-\u003eget('more.examples'); // returns 'test'\n\n$arrayer-\u003egetArray(); // returns the modified array\n```\n\nBuild a prepared output for file (This example uses Laravel's \"File\" class to put file contents):\n\n```php\n\n/**\n*   Available options for ArrayBuilder\n*    [\n*        'oldSyntax' =\u003e false, // use old array syntax\n*        'minify' =\u003e false,\n*        'indexes' =\u003e true, // Show the incremental indexes (array keys)\n*        'startWithScript' =\u003e true, // start with \u003c?php\n*        'initialStatement' =\u003e 'return ',\n*    ]\n*/\n$builder = new \\Mascame\\Arrayer\\Builder\\ArrayBuilder($arrayer-\u003egetArray(), $options);\n\nFile::put('test.php', $builder-\u003egetContent()); // getContent returns a prepared output to put in a file\n\n/**\n*   Available options for JsonBuilder\n*    [\n*        'minify' =\u003e false,\n*    ]\n*/\n$builder = new \\Mascame\\Arrayer\\Builder\\JsonBuilder($arrayer-\u003egetArray(), $options);\n\nFile::put('test.json', $builder-\u003egetContent());\n```\n\nChangelog\n----\n\n### 3.4\n- Fix missing files after migration to PSR-4 \n\n### 3.3\n- ArrayBuilder 'indexes' option to remove the incremental indexes (array keys)\n\n### 3.1\n- Simplification\n- Improved builders\n\n### 3.0\n- Simplified code\n- Improved ArrayBuilder, added options and included JsonBuilder\n- Removed -\u003eappend() method @ Arrayer because was a bit confusing\n- Removed not used laravel specific files\n\n### 2.1\n- Added tests\n- Fixed arrayDot not being created on constructor\n- Removed unnecessary dependency\n\n### 2.0\n- Added manipulation methods (get, set, delete)\n- Dot notation\n- Extracted builder\n\n### 1.1\n- Added escaping for keys and values\n\n\nContributing\n----\n\nThank you for considering contributing! You can contribute at any time forking the project and making a pull request.\n\nSupport\n----\n\nIf you need help or any kind of support, please send an e-mail to Marc Mascarell at marcmascarell@gmail.com.\n\nLicense\n----\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcmascarell%2Farrayer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcmascarell%2Farrayer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcmascarell%2Farrayer/lists"}