{"id":22900323,"url":"https://github.com/vectorial1024/alof-lib","last_synced_at":"2026-02-02T04:02:55.098Z","repository":{"id":208835436,"uuid":"722611052","full_name":"Vectorial1024/alof-lib","owner":"Vectorial1024","description":"PHP array-like object functions library.","archived":false,"fork":false,"pushed_at":"2024-11-05T08:05:38.000Z","size":92,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-08T01:12:13.579Z","etag":null,"topics":["arrayaccess","php","php8","traversable"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/vectorial1024/alof-lib","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/Vectorial1024.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"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}},"created_at":"2023-11-23T14:17:25.000Z","updated_at":"2024-11-05T08:05:27.000Z","dependencies_parsed_at":"2024-11-05T07:27:04.338Z","dependency_job_id":"4be1046c-b6a6-4599-a706-6439575de5f0","html_url":"https://github.com/Vectorial1024/alof-lib","commit_stats":null,"previous_names":["vectorial1024/alof-lib"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vectorial1024%2Falof-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vectorial1024%2Falof-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vectorial1024%2Falof-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vectorial1024%2Falof-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vectorial1024","download_url":"https://codeload.github.com/Vectorial1024/alof-lib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252978779,"owners_count":21834917,"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":["arrayaccess","php","php8","traversable"],"created_at":"2024-12-14T01:19:01.424Z","updated_at":"2026-02-02T04:02:50.079Z","avatar_url":"https://github.com/Vectorial1024.png","language":"PHP","readme":"# alof-lib\n[![Packagist License][packagist-license-image]][packagist-url]\n[![Packagist Version][packagist-version-image]][packagist-url]\n[![Packagist Downloads][packagist-downloads-image]][packagist-stats-url]\n[![PHP Dependency Version][php-version-image]][packagist-url]\n[![GitHub Actions Workflow Status][php-build-status-image]][github-actions-url]\n[![GitHub Repo Stars][github-stars-image]][github-repo-url]\n[![readthedocs](https://readthedocs.org/projects/alof-lib/badge/?version=latest)](https://alof-lib.readthedocs.io/en/latest/?badge=latest)\n\n(This is a WIP project!)\n\nPHP array-like object functions library (\"alof-lib\"). Type-hinted functions for array-like objects, just like [those for native arrays](https://www.php.net/manual/en/ref.array.php). Think of this library as a polyfill of those useful functions for array-like objects, so that you may write clean code with array-like objects.\n\nAn array-like object (\"ALO\") is defined to be `implements ArrayAccess` and `implements Traversable`. Examples include:\n- [ArrayObject](https://www.php.net/manual/en/class.arrayobject.php) (since PHP 5)\n- [ArrayIterator](https://www.php.net/manual/en/class.arrayiterator.php) (since PHP 5)\n- [SplObjectStorage](https://www.php.net/manual/en/class.splobjectstorage.php) (since PHP 5.1)\n- [SplDoublyLinkedList](https://www.php.net/manual/en/class.spldoublylinkedlist.php) (since PHP 5.3)\n- [SplFixedArray](https://www.php.net/manual/en/class.splfixedarray.php) (since PHP 5.3)\n- [SplStack](https://www.php.net/manual/en/class.splstack.php) (since PHP 5.3)\n- [SplQueue](https://www.php.net/manual/en/class.splqueue.php) (since PHP 5.3)\n- [WeakMap](https://www.php.net/manual/en/class.weakmap.php) (since PHP 8)\n- ... and perhaps more\n\nA PHP `array` is NOT an ALO. It is still an array.\n\nLatest version requires PHP 8.1+.\n\nSee the change log in the `CHANGELOG.md` file.\n\nWant to easily process ALOs? See `vectorial1024/transmutation` [here](https://github.com/Vectorial1024/transmutation).\n\n## Notes and Disclaimers\n- ALO functions aim to be faithful user-land reproductions of their array function counterparts, but there might be slight differences between both sides\n- Some ALO functions may not make sense depending on your exact ALO implementation; use judgement before you use the ALO functions\n\n## Installation\nvia Composer:\n\n```sh\ncomposer require vectorial1024/alof_lib\n```\n\n## Testing\nThis library uses PHPUnit for testing, which can be triggered from Composer. To test this library, run:\n\n```shell\ncomposer run-script test\n```\n\n## Example Usage\nRefer to the test cases under `/tests` for more examples, but for a minimal example:\n```php\nuse Vectorial1024\\AlofLib\\Alof;\n\n$objKey = new stdClass();\n$objKey-\u003ename = \"foo\";\n\n// conveniently get the keys of the WeakMap (WeakMap becomes a \"WeakHashSet\" for objects)\n$map = new WeakMap();\n$map[$objKey] = \"1\";\n$map[$objKey] = 2;\n$map[$objKey] = \"Hello World!\";\n$keys = Alof::alo_keys($map);\nassert($keys === [$objKey]); // passes\n\n// correctly get the keys of the SplObjectStorage (no more nasty foreach surprises!)\n$splObjectStore = new SplObjectStorage();\n$splObjectStore[$objKey] = \"Hello World!\";\n$keys = Alof::alo_keys($splObjectStore);\nassert($keys === [$objKey]); // passes\n```\n\n## Relationship with `transmutation`\nThis library does the dirty work and ensures the correctness of ALO functions, while `transmutation` provides an easy-to-use API for ALO processing.\n\n[packagist-url]: https://packagist.org/packages/vectorial1024/alof-lib\n[packagist-stats-url]: https://packagist.org/packages/vectorial1024/alof-lib/stats\n[github-repo-url]: https://github.com/Vectorial1024/alof-lib\n[github-actions-url]: https://github.com/Vectorial1024/alof-lib/actions/workflows/php.yml\n\n[packagist-license-image]: https://img.shields.io/packagist/l/vectorial1024/alof-lib?style=plastic\n[packagist-version-image]: https://img.shields.io/packagist/v/vectorial1024/alof-lib?style=plastic\n[packagist-downloads-image]: https://img.shields.io/packagist/dm/vectorial1024/alof-lib?style=plastic\n[php-version-image]: https://img.shields.io/packagist/dependency-v/vectorial1024/alof-lib/php?style=plastic\u0026label=PHP\n[php-build-status-image]: https://img.shields.io/github/actions/workflow/status/Vectorial1024/alof-lib/php.yml?style=plastic\n[github-stars-image]: https://img.shields.io/github/stars/vectorial1024/alof-lib\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvectorial1024%2Falof-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvectorial1024%2Falof-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvectorial1024%2Falof-lib/lists"}