PHPackages                             yonyon/eloquent-schema-query - 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. yonyon/eloquent-schema-query

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

yonyon/eloquent-schema-query
============================

EloquentSchemaQuery is a library that extracts only required items from Eloquent.

v1.0.1(8y ago)159MITPHPPHP &gt;=5.4.0

Since Aug 16Pushed 8y ago1 watchersCompare

[ Source](https://github.com/44x1carbon/EloquentSchemaQuery)[ Packagist](https://packagist.org/packages/yonyon/eloquent-schema-query)[ RSS](/packages/yonyon-eloquent-schema-query/feed)WikiDiscussions master Synced today

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

EloquentSchemaQuery
===================

[](#eloquentschemaquery)

***EloquentSchemaQuery*** is a library that extracts only required items from Eloquent. Describe items to be acquired using schema.

Install
=======

[](#install)

```
composer require yonyon/eloquent-schema-query::dev-master

```

Use Laravel
===========

[](#use-laravel)

After updating composer, add the service provider to the providers array in config/app.php

```
'providers' => [
    // Other service providers...

    yonyon\EloquentSchemaQuery\Provider\EloquentSchemaQueryServiceProvider::class,
],

```

Also, add the facade to the aliases array in your app configuration file:

```
'EloquentSchemaQuery' => \yonyon\EloquentSchemaQuery\Facades\EloquentSchemaQuery::class,

```

Example
=======

[](#example)

```
$user = User::find(1);

$schema = new Schema([
  'id',
  'name',
  'todos' => new Schema([
    'name'
  ])
]);

$result = EloquentSchemaQuery::get($user, $schema);
```

When you want to change the item name
=====================================

[](#when-you-want-to-change-the-item-name)

The second argument to schema is an alias for the item name.

```
$schema = new Schema([
  'id',
  'name',
  'todos' => new Schema([
    'name'
  ], 'todo_list')
]);
```

FunctionSchema
==============

[](#functionschema)

FunctionSchema is used when you want to obtain the result of executing eloquent's query, such as the number of todo.

```
$schema = new Schema([
  'id',
  'name',
  'todo_count' => new FunctionSchema(function($user) {
    return $user->todos->count();
  })
]);
```

If the query result is Collection or Model, you have to define schema as the second argument.

```
$schema = new Schema([
  'id',
  'name',
  'todo_count' => new FunctionSchema(
    function($user) {
      return $user->todos;
    },
    new Schema([
      'name'
    ]
  )
]);
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

3239d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2698769?v=4)[yonyon](/maintainers/yonyon)[@yonyon](https://github.com/yonyon)

---

Top Contributors

[![yonyon-web](https://avatars.githubusercontent.com/u/9666372?v=4)](https://github.com/yonyon-web "yonyon-web (8 commits)")

### Embed Badge

![Health badge](/badges/yonyon-eloquent-schema-query/health.svg)

```
[![Health](https://phpackages.com/badges/yonyon-eloquent-schema-query/health.svg)](https://phpackages.com/packages/yonyon-eloquent-schema-query)
```

###  Alternatives

[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k29.9M42](/packages/kirschbaum-development-eloquent-power-joins)[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.0M88](/packages/mongodb-laravel-mongodb)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8723.1M23](/packages/yajra-laravel-oci8)[staudenmeir/laravel-adjacency-list

Recursive Laravel Eloquent relationships with CTEs

1.6k5.2M33](/packages/staudenmeir-laravel-adjacency-list)[bavix/laravel-wallet

It's easy to work with a virtual wallet.

1.3k1.2M19](/packages/bavix-laravel-wallet)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.4M2](/packages/glushkovds-phpclickhouse-laravel)

PHPackages © 2026

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