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

AbandonedLibrary

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

Abstract transformers for collections and arrays.

6.0.1(1y ago)15821MITPHPPHP ^8.1|^8.2

Since Nov 30Pushed 1y 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 2mo ago

READMEChangelog (10)Dependencies (5)Versions (19)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

40

—

FairBetter than 88% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity84

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 80.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 ~152 days

Recently: every ~334 days

Total

17

Last Release

646d 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 (29 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

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.2k](/packages/larastan-larastan)[ilya/belt

A handful of tools for PHP developers.

71020.8k1](/packages/ilya-belt)[fuel/fuel

FuelPHP is a simple, flexible, community driven PHP 5.4+ framework, based on the best ideas of other frameworks, with a fresh start!

1.5k42.3k](/packages/fuel-fuel)[cartalyst/collections

Collection Abstaction library for PHP.

76908.6k4](/packages/cartalyst-collections)[webparking/laravel-type-safe-collection

This package provides type-safe extension of the laravel collection, forcing a single type of object.

378.2k](/packages/webparking-laravel-type-safe-collection)[jeffreyhyer/bamboohr

PHP SDK for the BambooHR API

1077.3k1](/packages/jeffreyhyer-bamboohr)

PHPackages © 2026

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