PHPackages                             navarr/iterable-to-array - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. navarr/iterable-to-array

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

navarr/iterable-to-array
========================

A method for converting an iterable to an array, no matter what type of iterable

v1.0.1(8mo ago)111.5k↓17.8%MITPHPPHP ^8.2CI passing

Since Nov 4Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/navarr/iterable_to_array)[ Packagist](https://packagist.org/packages/navarr/iterable-to-array)[ GitHub Sponsors](https://github.com/navarr)[ RSS](/packages/navarr-iterable-to-array/feed)WikiDiscussions main Synced yesterday

READMEChangelog (2)Dependencies (6)Versions (4)Used By (0)

IterableToArray::convert
========================

[](#iterabletoarrayconvert)

[![Latest Stable Version](https://camo.githubusercontent.com/0f6c423002a685e5b73616702a9f07059eb264f9bb0119f032b33cfa3ee1b9fd/687474703a2f2f706f7365722e707567782e6f72672f6e61766172722f6974657261626c652d746f2d61727261792f76)](https://packagist.org/packages/navarr/iterable-to-array)[![Total Downloads](https://camo.githubusercontent.com/b5c64b86b57f438d808b18a2fd12c4374af12c3d2be2d077a9c210090423f458/687474703a2f2f706f7365722e707567782e6f72672f6e61766172722f6974657261626c652d746f2d61727261792f646f776e6c6f616473)](https://packagist.org/packages/navarr/iterable-to-array)[![Latest Unstable Version](https://camo.githubusercontent.com/bbe146954985e44e1be17d084bd6cfe8308eb763e47627e390ca602919675b72/687474703a2f2f706f7365722e707567782e6f72672f6e61766172722f6974657261626c652d746f2d61727261792f762f756e737461626c65)](https://packagist.org/packages/navarr/iterable-to-array)[![License](https://camo.githubusercontent.com/390e9375eed8c7825b139f868fae92983241efb3e93db0536800b5f0b48f1560/687474703a2f2f706f7365722e707567782e6f72672f6e61766172722f6974657261626c652d746f2d61727261792f6c6963656e7365)](https://packagist.org/packages/navarr/iterable-to-array)
[![Tests](https://github.com/navarr/iterable_to_array/actions/workflows/commit.yml/badge.svg)](https://github.com/navarr/iterable_to_array/actions/workflows/commit.yml)[![Code Coverage](https://camo.githubusercontent.com/68ada39c549b32d2f7219f7626888a25341d1eb9b4e9e209e0708ecb46f6ee08/68747470733a2f2f636f6465636f762e696f2f67682f6e61766172722f6974657261626c655f746f5f61727261792f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d444a52554a5456324757)](https://app.codecov.io/gh/navarr/iterable_to_array/)[![Mutation score](https://camo.githubusercontent.com/8fb862fa5f07f12aa28bbe1892ec6669905d8a34305eada01572d436656f5dfc/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d2532466e61766172722532466974657261626c655f746f5f61727261792532466d61696e)](https://dashboard.stryker-mutator.io/reports/github.com/navarr/iterable_to_array/main)

A simple utility class that handles the boilerplate of converting an iterable into an array.

The goal of this utility is to be an in-place replacement for iterator\_to\_array whenever one must handle an iterable.

Installation
------------

[](#installation)

```
composer require navarr/iterable-to-array

```

Usage
-----

[](#usage)

```
