PHPackages                             ramasdev/simple-collection-transformer - 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. ramasdev/simple-collection-transformer

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

ramasdev/simple-collection-transformer
======================================

Simple data to Laravel collection transformer.

1.0.1(3y ago)13MITPHPPHP ^8.0

Since Sep 2Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ramasofficial/simple-collection-transformer)[ Packagist](https://packagist.org/packages/ramasdev/simple-collection-transformer)[ RSS](/packages/ramasdev-simple-collection-transformer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (5)Used By (0)

Simple Collection Transformer
=============================

[](#simple-collection-transformer)

Simple data to Laravel collection transformer, don't write Collection transformers anymore!

- Lets you utilize filters through callback function.

Install
-------

[](#install)

```
composer require ramasdev/simple-collection-transformer

```

Usage
-----

[](#usage)

Create DTO/Model class and provide collection class through attributes to which need to transform:

```
use Ramasdev\SimpleCollectionTransformer\Attributes\CollectionAttribute;
use Ramasdev\SimpleCollectionTransformer\Tests\Unit\Data\Collections\ChannelCollection;

#[CollectionAttribute(ChannelCollection::class)]
class Channel
{
    public function __construct(
        private string $channelId,
        private string $channelType,
        private Carbon $lastRegistration
    ) {
    }

    public function getChannelId(): string
    {
        return $this->channelId;
    }

    public function getChannelType(): string
    {
        return $this->channelType;
    }

    public function getLastRegistration(): Carbon
    {
        return $this->lastRegistration;
    }
}
```

Transform to collection with filters:

```
use Ramasdev\SimpleCollectionTransformer\CollectionTransformer;

$actualCollection = $this->collectionTransformer->transform($data, function ($item) {
    if ($item['channel_id'] === 'b') {
        return false;
    }

    return new Channel($item['channel_id'], $item['channel_type'], new Carbon($item['last_registration']));
}); // Returns ChannelCollection
```

You can utilize it with you deserializer component also, for example:

```
use Ramasdev\SimpleCollectionTransformer\CollectionTransformer;

$actualCollection = $this->collectionTransformer->transform($data, function ($item) {
    return $this->decoder->decodeArray((array) $item, Channel::class);
}); // Returns ChannelCollection
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

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 ~27 days

Total

4

Last Release

1270d ago

Major Versions

0.2.0 → 1.0.02022-09-05

### Community

Maintainers

![](https://www.gravatar.com/avatar/3e8cac471f4ba9752cae0edeaa8b85d45afa7f9cb559f80f1a043d42a5add6b3?d=identicon)[ramasofficial](/maintainers/ramasofficial)

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ramasdev-simple-collection-transformer/health.svg)

```
[![Health](https://phpackages.com/badges/ramasdev-simple-collection-transformer/health.svg)](https://phpackages.com/packages/ramasdev-simple-collection-transformer)
```

###  Alternatives

[ergebnis/phpstan-rules

Provides rules for phpstan/phpstan.

4428.9M187](/packages/ergebnis-phpstan-rules)[symfony/ldap

Provides a LDAP client for PHP on top of PHP's ldap extension

1407.5M46](/packages/symfony-ldap)[typo3/cms-scheduler

TYPO3 CMS Scheduler - Schedule tasks to run once or periodically at a specific time.

168.8M157](/packages/typo3-cms-scheduler)[laramall/laravel-system-info

查看服务器所有信息 system info

311.0k1](/packages/laramall-laravel-system-info)

PHPackages © 2026

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