PHPackages                             aviator/shaper - 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. aviator/shaper

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

aviator/shaper
==============

Abstract transformers for collections and arrays.

6.2.0(4mo ago)15821MITPHPPHP ^8.1|^8.2CI failing

Since Nov 30Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/danielsdeboer/shaper)[ Packagist](https://packagist.org/packages/aviator/shaper)[ Docs](https://github.com/danielsdeboer/shaper)[ RSS](/packages/aviator-shaper/feed)WikiDiscussions trunk Synced 2w ago

READMEChangelog (10)Dependencies (10)Versions (22)Used By (0)

[![Build Status](https://camo.githubusercontent.com/01e1a636a0bb9812032bb5e8b00321babccb4425f9fae61fbbf69c98eb0595f7/68747470733a2f2f7472617669732d63692e6f72672f64616e69656c736465626f65722f7368617065722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/danielsdeboer/shaper)[![Latest Stable Version](https://camo.githubusercontent.com/6cd00312f2f01231c63c9aa80f077627bf5f471d8dc01ff86f391643ed32c403/68747470733a2f2f706f7365722e707567782e6f72672f61766961746f722f7368617065722f762f737461626c65)](https://packagist.org/packages/aviator/shaper)[![License](https://camo.githubusercontent.com/47c753ff3a6aedc0caa66a2ff1401b6f327365a9b695c0a322ee7e152ba793d7/68747470733a2f2f706f7365722e707567782e6f72672f61766961746f722f7368617065722f6c6963656e7365)](https://packagist.org/packages/aviator/shaper)

Overview
--------

[](#overview)

Shaper provides an interface and abstract classes which can be extended to create array or collection shaper classes. These classes can then be reused to shape the same sort of iterable, eg when preparing for serialization.

### Installation

[](#installation)

Via Composer:

```
composer require aviator/shaper

```

### Testing

[](#testing)

Via Composer:

```
composer test

```

### Usage

[](#usage)

Extend either the collection or array shaper and define a public method called `shaper()`:

```
public function shaper ($item)
{
    return [
        'mutated_name' => ucfirst($item['name')
    ];
}
```

This callback can do whatever you like. Once you've defined your class, you can instantiate it and call `shape()`, which maps over your iterable and applies the callback:

```
$shaper = new MyArrayShaper($array);
$shaped = $shaper->shape();
```

You can also set the iterable after instantiation:

```
$shaper = new MyArrayShaper();

// Returns null
$shaper->get();

$shaper->set($yourArray);

// Returns the array
$shaper->get();
```

Other
-----

[](#other)

### License

[](#license)

This package is licensed with the [MIT License (MIT)](LICENSE).

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance74

Regular maintenance activity

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity85

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 81.6% 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

Every ~169 days

Recently: every ~190 days

Total

19

Last Release

139d ago

Major Versions

1.0.2 → 2.0.22020-09-28

2.0.2 → 3.0.02020-12-09

3.0.0 → 4.0.02022-05-09

4.0.0 → 5.0.02024-02-27

5.0.0 → 6.0.02024-08-07

PHP version history (6 changes)0.1.0PHP &gt;=7.0.0

2.0.0PHP &gt;=7.2.0

3.0.0PHP &gt;=7.2.5

4.0.0PHP &gt;=7.3.0

5.0.0PHP ^8.1

6.0.0PHP ^8.1|^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/ebd3fe214b5768e700ae43c7fdc4b83d249972a6a97a0faef372d0ec19256eca?d=identicon)[danielsdeboer](/maintainers/danielsdeboer)

---

Top Contributors

[![danielsdeboer](https://avatars.githubusercontent.com/u/13170241?v=4)](https://github.com/danielsdeboer "danielsdeboer (31 commits)")[![kaydenvanrijn](https://avatars.githubusercontent.com/u/62964405?v=4)](https://github.com/kaydenvanrijn "kaydenvanrijn (7 commits)")

---

Tags

arraycollectionsphpphp7shapertransformphpcollectionstransformerarraysPHP7shaper

###  Code Quality

TestsPHPUnit

Static AnalysisRector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/aviator-shaper/health.svg)

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

###  Alternatives

[ilya/belt

A handful of tools for PHP developers.

71020.9k1](/packages/ilya-belt)[efureev/laravel-trees

Multi-Tree structures for Laravel

14257.6k6](/packages/efureev-laravel-trees)[forjedio/inertia-table

Backend-driven dynamic tables for Laravel + Inertia.js

272.0k](/packages/forjedio-inertia-table)[tehwave/laravel-achievements

Simple, elegant Achievements the Laravel way

7213.1k](/packages/tehwave-laravel-achievements)

PHPackages © 2026

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