PHPackages                             mario-legenda/entity-filter - 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. [Database &amp; ORM](/categories/database)
4. /
5. mario-legenda/entity-filter

ActiveLibrary[Database &amp; ORM](/categories/database)

mario-legenda/entity-filter
===========================

Filters collection of entities and transformers them into array

1.0.0(10y ago)017MITPHPPHP &gt;=5.3.0

Since Sep 6Pushed 10y ago1 watchersCompare

[ Source](https://github.com/MarioLegenda/entity-filter)[ Packagist](https://packagist.org/packages/mario-legenda/entity-filter)[ Docs](https://github.com/MarioLegenda/entity-filter)[ RSS](/packages/mario-legenda-entity-filter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

Entity filter
-------------

[](#entity-filter)

Filters Doctrine enitites and transformers them into arrays. Examples speak for themselves, so read on.

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

[](#installation)

`$ composer require mario-legenda/entity-filter`

Basic usage
-----------

[](#basic-usage)

Let's say we have a `User` entity that has 25 fields that describe a certain user, like name, lastname, social security number etc. If you want only 10 of those fields, you would have to manually call each and every method and place them in some variables. Code is as follows...

```
$user = new User();

$name = $user->getName()
$lastname = $user->getLastname();
... 8 remaining fields

```

This creates some ugly code. If you wish to put the values of those fields in an array, the code is even uglier.

```
$user = new User();

$userData['name'] = $user->getName();
$userData['lastname'] = $user->getName();
... 8 remainig fields

```

Now, you could say that you can query the database with DQL, but in some cases, you need a clean entity if, for example, you wish to update the User to the database. This is the situtation where this tool comes in handy.

```
$user = new User();
$entityFilter = new EntityFilter();

$filtered = $entityFilter
               ->setEntity($user)
               ->configure(array(
                   'id', 'name', 'lastname', 'ssn'
               ))
               ->setDataVar('user')
               ->getFiltered();

```

`$filtered` is an array that holds `id`, `name` and other values that you ask from it. `EntityFilter::setDataVar()`sets the value of an array key that holds the array with the specified values from the User entity. Default is `data`.

I hope that someone finds this helpfull.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

3906d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6998286?v=4)[Mario Škrlec](/maintainers/MarioLegenda)[@MarioLegenda](https://github.com/MarioLegenda)

---

Tags

phpdoctrine

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mario-legenda-entity-filter/health.svg)

```
[![Health](https://phpackages.com/badges/mario-legenda-entity-filter/health.svg)](https://phpackages.com/packages/mario-legenda-entity-filter)
```

###  Alternatives

[pmill/doctrine-array-hydrator

 An array to entity hydrator for Doctrine 2 entities

36482.9k3](/packages/pmill-doctrine-array-hydrator)[jawira/db-draw

📐 Takes a DoctrineORM connection and generates a database diagram in .puml format

2295.1k2](/packages/jawira-db-draw)[kucharovic/money-bundle

This bundle provides integration for Money library in your Symfony project.

2253.7k](/packages/kucharovic-money-bundle)[fourlabs/qbjs-parser

Parse JSON coming from jQuery QueryBuilder, into database queries.

2535.3k2](/packages/fourlabs-qbjs-parser)[fourlabs/qbjs-parser-bundle

This bundle is a Symfony wrapper for fourlabs/qbjs-parser.

1514.7k1](/packages/fourlabs-qbjs-parser-bundle)[andanteproject/soft-deletable-bundle

A Symfony Bundle to handle soft deletable with Doctrine Entities

1028.3k](/packages/andanteproject-soft-deletable-bundle)

PHPackages © 2026

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