{"id":20244772,"url":"https://github.com/renoki-co/laravel-explicit-array","last_synced_at":"2025-07-02T11:39:11.930Z","repository":{"id":36992054,"uuid":"421948177","full_name":"renoki-co/laravel-explicit-array","owner":"renoki-co","description":"Improved Laravel dot notation for explicit array keys.","archived":false,"fork":false,"pushed_at":"2024-05-27T04:27:40.000Z","size":69,"stargazers_count":8,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T23:57:27.845Z","etag":null,"topics":["arr","array","laravel","php","support"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/renoki-co.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"rennokki"}},"created_at":"2021-10-27T19:28:18.000Z","updated_at":"2024-05-31T08:49:46.000Z","dependencies_parsed_at":"2024-05-06T05:27:11.953Z","dependency_job_id":"21ca4f25-9960-4740-b844-642b70794a20","html_url":"https://github.com/renoki-co/laravel-explicit-array","commit_stats":{"total_commits":48,"total_committers":4,"mean_commits":12.0,"dds":"0.41666666666666663","last_synced_commit":"94338fc9b47e8a828cd14855fdcabdaf84c4ab31"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":"renoki-co/laravel-package-skeleton","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renoki-co%2Flaravel-explicit-array","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renoki-co%2Flaravel-explicit-array/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renoki-co%2Flaravel-explicit-array/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renoki-co%2Flaravel-explicit-array/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/renoki-co","download_url":"https://codeload.github.com/renoki-co/laravel-explicit-array/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248296492,"owners_count":21080301,"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":["arr","array","laravel","php","support"],"created_at":"2024-11-14T09:17:20.949Z","updated_at":"2025-04-10T20:51:06.849Z","avatar_url":"https://github.com/renoki-co.png","language":"PHP","funding_links":["https://github.com/sponsors/rennokki"],"categories":[],"sub_categories":[],"readme":"Laravel Explicit Array\n======================\n\n![CI](https://github.com/renoki-co/laravel-explicit-array/workflows/CI/badge.svg?branch=master)\n[![codecov](https://codecov.io/gh/renoki-co/laravel-explicit-array/branch/master/graph/badge.svg)](https://codecov.io/gh/renoki-co/laravel-explicit-array/branch/master)\n[![StyleCI](https://github.styleci.io/repos/421948177/shield?branch=master)](https://github.styleci.io/repos/421948177)\n[![Latest Stable Version](https://poser.pugx.org/renoki-co/laravel-explicit-array/v/stable)](https://packagist.org/packages/renoki-co/laravel-explicit-array)\n[![Total Downloads](https://poser.pugx.org/renoki-co/laravel-explicit-array/downloads)](https://packagist.org/packages/renoki-co/laravel-explicit-array)\n[![Monthly Downloads](https://poser.pugx.org/renoki-co/laravel-explicit-array/d/monthly)](https://packagist.org/packages/renoki-co/laravel-explicit-array)\n[![License](https://poser.pugx.org/renoki-co/laravel-explicit-array/license)](https://packagist.org/packages/renoki-co/laravel-explicit-array)\n\nImproved Laravel dot notation for explicit array keys.\n\n## 🚀 Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require renoki-co/laravel-explicit-array\n```\n\n## 🙌 Usage\n\nThe original Laravel's `Arr::set()` method treats the dots within the key as separators for nested values. This is expected. The segments will create a nested value `some -\u003e annotation -\u003e com/ttl` with a value of `1800`.\n\n```php\n$annotations = [\n    'some.annotation.com/ttl' =\u003e 900,\n];\n\nArr::set($annotations, 'some.annotation.com/ttl', 1800);\n\n// Current result\n// [\n//     'some' =\u003e [\n//         'annotation' =\u003e [\n//             'com/ttl' =\u003e 1800\n//         ]\n//     ]\n// ]\n\n// Desired result\n// [\n//     'some.annotation.com/ttl' =\u003e 1800\n// ]\n```\n\nTo fix this, Explicit Array introduces a new `RenokiCo\\ExplicitArray\\Arr` class, which altered the `::set()` method, so that will make sure to read the segments between quotes as literal keys.\n\n**You may use this class as your regular `Arr` class because it extends the original `\\Illuminate\\Support\\Arr` class.**\n\n```php\nuse RenokiCo\\ExplicitArray\\Arr;\n\nArr::set($annotations, '\"some.annotation.com/ttl\"', 1800);\n\n// [\n//     'some.annotation.com/ttl' =\u003e 1800\n// ]\n```\n\nThis can work with mixed segments, meaning that as long as you keep the dots outside the quotes, you can specify nested values:\n\n```php\nuse RenokiCo\\ExplicitArray\\Arr;\n\nArr::set($annotations, 'annotations.nested.\"some.annotation.com/ttl\"', 1800);\n\n// [\n//     'annotations' =\u003e [\n//         'nested' =\u003e [\n//             'some.annotation.com/ttl' =\u003e 1800\n//         ]\n//     ]\n// ]\n```\n\n## 🐛 Testing\n\n``` bash\nvendor/bin/phpunit\n```\n\n## 🤝 Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## 🔒  Security\n\nIf you discover any security related issues, please email alex@renoki.org instead of using the issue tracker.\n\n## 🎉 Credits\n\n- [Alex Renoki](https://github.com/rennokki)\n- [All Contributors](../../contributors)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenoki-co%2Flaravel-explicit-array","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frenoki-co%2Flaravel-explicit-array","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenoki-co%2Flaravel-explicit-array/lists"}