PHPackages                             netdudes/data-sourcery-bundle - 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. netdudes/data-sourcery-bundle

AbandonedArchivedSymfony-bundle[Utility &amp; Helpers](/categories/utility)

netdudes/data-sourcery-bundle
=============================

Netdudes DataSourceryBundle

27.2k1[2 issues](https://github.com/netdudes/DataSourceryBundle/issues)PHP

Since May 31Pushed 9y ago2 watchersCompare

[ Source](https://github.com/netdudes/DataSourceryBundle)[ Packagist](https://packagist.org/packages/netdudes/data-sourcery-bundle)[ RSS](/packages/netdudes-data-sourcery-bundle/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (4)Used By (0)

### \*\*\*\*\*\* WARNING: THIS PROJECT IS NO LONGER MAINTAINED!! \*\*\*\*\*\*

[](#-warning-this-project-is-no-longer-maintained-)

Netdudes\\DataSourceryBundle
============================

[](#netdudesdatasourcerybundle)

[![Build Status](https://camo.githubusercontent.com/30eb4a331c2d60df08fe123d061396937e88c64b5bd0d27b82cca310cb6f73e6/68747470733a2f2f7472617669732d63692e6f72672f6e657464756465732f44617461536f75726365727942756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/netdudes/DataSourceryBundle)[![Code Climate](https://camo.githubusercontent.com/76ae230213d83083933e98f39acdc733db77b6114b50effd72de2c7b500b766b/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6e657464756465732f44617461536f75726365727942756e646c652f6261646765732f6770612e737667)](https://codeclimate.com/github/netdudes/DataSourceryBundle)[![SensioLabsInsight](https://camo.githubusercontent.com/f7ad71c754d8b1d280a6ba182a9103fc1b9effe40260653a87724d7a63bb6b03/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f30316162656666642d316134372d343763652d396537342d6563353737623763666662362f6d696e692e706e67)](https://insight.sensiolabs.com/projects/01abeffd-1a47-47ce-9e74-ec577b7cffb6)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/95031571ad1bf8186ae41f24d16adbeaae5023a4f3e2a29604f2e3ce5df69666/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6e657464756465732f44617461536f75726365727942756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/netdudes/DataSourceryBundle/?branch=master)

[![Latest Stable Version](https://camo.githubusercontent.com/d21fd097460106090ed27499397e7646bfd80023bfcf0890af11347d9ea1b7d2/68747470733a2f2f706f7365722e707567782e6f72672f6e657464756465732f646174612d736f7572636572792d62756e646c652f762f737461626c652e737667)](https://packagist.org/packages/netdudes/data-sourcery-bundle) [![Total Downloads](https://camo.githubusercontent.com/f840ba976f7d1d04cb098c3f8e830df6ca7a64eb888a5dc7e4f917243b652cc5/68747470733a2f2f706f7365722e707567782e6f72672f6e657464756465732f646174612d736f7572636572792d62756e646c652f646f776e6c6f6164732e737667)](https://packagist.org/packages/netdudes/data-sourcery-bundle) [![Latest Unstable Version](https://camo.githubusercontent.com/a98d2f498c57769d90c67fbf43ffab04304d27e40a5e5cc3db7cc9b37ca20b85/68747470733a2f2f706f7365722e707567782e6f72672f6e657464756465732f646174612d736f7572636572792d62756e646c652f762f756e737461626c652e737667)](https://packagist.org/packages/netdudes/data-sourcery-bundle) [![License](https://camo.githubusercontent.com/8927d0041e2e3863a84e7eb8b8c748b35093c6bce4d4ee5445623ba6de053816/68747470733a2f2f706f7365722e707567782e6f72672f6e657464756465732f646174612d736f7572636572792d62756e646c652f6c6963656e73652e737667)](https://packagist.org/packages/netdudes/data-sourcery-bundle)

DataSourceryBundle is a neat tool to handle building and performing complex queries on data sets, including support for natural-language queries and safe handling of user provided query parameters.

Usage *(work in progress!)*
---------------------------

[](#usage-work-in-progress)

Assume we have one entity in our system managed by **Doctrine**, called `User`, that looks like this:

```
User {
	string username
	string nameFirst
	string nameLast
	\DateTime registered
	User bestFriend => OtM with another user
	User worstEnemy => OtM with another user
}

```

You can get the building block of the library, the `DataSource`, from a builder. From here and now on we will assume you have a DI container (e.g. Symfony) where the needed services are registered.

```
$dataSourceBuilder = $container
    ->get('netdudes_data_sourcery.data_source.factory')
    ->createBuilder('My\Entities\User');
```

With a builder is easy to create a `Datasource`

```
$dataSourceBuilder
    ->addField('username', 'string', 'username')
    ->addField('bestFriendUsername' 'string', 'bestFriend.username')
    ->addField('worstEnemyUsername', 'string', 'worstEnemy.username')
    ->addField('friendOfMyEnemyUsername', 'string', 'worstEnemy.bestFriend.username')
    ->addField('registered', 'date', 'registered');

$dataSource = $dataSourceBuilder->build();
```

Alternatively, a data source can be generated from a configuration class, very similarly to how Symfony Forms are built.

```
class MyNiceDataSourceConfig implements DataSourceConfigurationInterface
{

    public function getEntityClass()
    {
        return 'My\Entities\User';
    }

    public function buildDataSource(DataSourceBuilderInterface $builder)
    {
        $builder
            ->addField('username', 'string', 'username')
            ->addField('bestFriendUsername', 'string', 'bestFriend.username')
            ->addField('worstEnemyUsername', 'string', 'worstEnemy.username')
            ->addField('friendOfMyEnemyUsername', 'string', 'worstEnemy.bestFriend.username')
            ->addField('registered', 'date', 'registered');
    }
}

$dataSource = $container
	->get('netdudes_data_sourcery.data_source.factory')
	->createFromConfiguration(new MyNiceDataSourceConfig());
```

In order to query you data source, you must have a `Query` object. Creating one manually is easy:

```
$query = new Query();
$query->setSelect(['username', 'bestFriendUsername', 'worstEnemyUsername', 'friendOfMyEnemyUsername', 'registered']);

$filter = new Filter(
    [
        new FilterCondition('username', FilterCondition::METHOD_STRING_EQ, 'admin')
    ]
);

$query->setFilter($filter);
```

Alternatively you can use the built in parser for the system's language, UQL:

```
$uqlInterpreter = $container->get('netdudes_data_sourcery.uql.interpreter.factory')->create($dataSource);
$filter = $uqlInterpreter->generateFilters('username != "admin"');

$query->setFilter($filter);
```

Finally, you can get your data from the data source

```
$data = $dataSource->getData($query);

dump($data);
```

Giving

```
array:1 [
  0 => array:5 [
    "username" => "admin"
    "bestFriendUsername" => "Max"
    "worstEnemyUsername" => "John"
    "friendOfMyEnemyUsername" => "Max"
    "registered" => DateTime {#124
      +"date": "2014-02-01 00:00:00.000000"
      +"timezone_type": 3
      +"timezone": "Europe/Berlin"
    }
  ]
]
```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/800592?v=4)[Jake Bishop](/maintainers/yakobe)[@yakobe](https://github.com/yakobe)

---

Top Contributors

[![adlpz](https://avatars.githubusercontent.com/u/602379?v=4)](https://github.com/adlpz "adlpz (41 commits)")[![mkruk-u2](https://avatars.githubusercontent.com/u/13467160?v=4)](https://github.com/mkruk-u2 "mkruk-u2 (27 commits)")[![yakobe](https://avatars.githubusercontent.com/u/800592?v=4)](https://github.com/yakobe "yakobe (15 commits)")[![senaria](https://avatars.githubusercontent.com/u/5164586?v=4)](https://github.com/senaria "senaria (13 commits)")[![guill3m](https://avatars.githubusercontent.com/u/1526816?v=4)](https://github.com/guill3m "guill3m (9 commits)")[![DrososTasos](https://avatars.githubusercontent.com/u/12499205?v=4)](https://github.com/DrososTasos "DrososTasos (6 commits)")

### Embed Badge

![Health badge](/badges/netdudes-data-sourcery-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/netdudes-data-sourcery-bundle/health.svg)](https://phpackages.com/packages/netdudes-data-sourcery-bundle)
```

###  Alternatives

[humanmade/asset-loader

Utilities to seamlessly consume Webpack-bundled assets in WordPress themes &amp; plugins.

27343.2k19](/packages/humanmade-asset-loader)[moosend/website-tracking

By installing the Moosend PHP Tracking library you are can track page views, product views, add to cart events and successful purchases. You can later use these details to segment your user base, run automations, check how successful your latest promo has been and how many conversions your landing page has led to.

1121.9k1](/packages/moosend-website-tracking)

PHPackages © 2026

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