PHPackages                             componenta/arrayable - 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. componenta/arrayable

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

componenta/arrayable
====================

Array conversion contract for Componenta packages

v1.0.0(1mo ago)0919MITPHPPHP ^8.4

Since Jun 16Pushed 1mo agoCompare

[ Source](https://github.com/componenta/arrayable)[ Packagist](https://packagist.org/packages/componenta/arrayable)[ RSS](/packages/componenta-arrayable/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (19)

Componenta Arrayable
====================

[](#componenta-arrayable)

Minimal contract for objects that expose a public array representation.

Use it when a package needs to accept DTOs, view models, pagination results, or collections without depending on a serializer implementation.

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

[](#installation)

```
composer require componenta/arrayable
```

Related Packages
----------------

[](#related-packages)

PackageWhy it matters here`componenta/array``to_array()` consumes `Arrayable` objects.`componenta/http-responder`Responders can turn arrayable objects into JSON responses.`componenta/paginator`Pagination results can expose a public array shape.Usage
-----

[](#usage)

```
use Componenta\Arrayable\Arrayable;

final readonly class UserView implements Arrayable
{
    public function __construct(
        public string $id,
        public string $name,
    ) {}

    public function toArray(): array
    {
        return [
            'id' => $this->id,
            'name' => $this->name,
        ];
    }
}
```

Contract
--------

[](#contract)

`Arrayable::toArray()` returns the public array representation of an object.

The interface does not define:

- JSON encoding
- recursive conversion rules
- key naming conventions
- whether private/internal state is included

Those decisions belong to the implementing object or to a serializer package.

Typical Consumers
-----------------

[](#typical-consumers)

Packages such as paginator, iterator helpers, HTTP responders, and config exporters can depend on this contract when they only need an array shape and do not need object-specific behavior.

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance91

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

43d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20490712?v=4)[Andrey Shelamkoff](/maintainers/Shelamkoff)[@Shelamkoff](https://github.com/Shelamkoff)

---

Top Contributors

[![Shelamkoff](https://avatars.githubusercontent.com/u/20490712?v=4)](https://github.com/Shelamkoff "Shelamkoff (1 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/componenta-arrayable/health.svg)

```
[![Health](https://phpackages.com/badges/componenta-arrayable/health.svg)](https://phpackages.com/packages/componenta-arrayable)
```

###  Alternatives

[utopia-php/messaging

A simple, light and advanced PHP messaging library

23236.1k6](/packages/utopia-php-messaging)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
