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

ActiveLibrary

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 2mo ago

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 43% 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

3191d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e9f242400c89766d9741d210c04a45e1f876471c9c2fdbd0d7369563df5a0921?d=identicon)[yonyon](/maintainers/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

[larastan/larastan

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

6.4k43.5M5.2k](/packages/larastan-larastan)[owen-it/laravel-auditing

Audit changes of your Eloquent models in Laravel

3.4k33.0M95](/packages/owen-it-laravel-auditing)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[casbin/laravel-authz

An authorization library that supports access control models like ACL, RBAC, ABAC in Laravel.

324339.9k4](/packages/casbin-laravel-authz)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

44643.1k1](/packages/pressbooks-pressbooks)[illuminatech/balance

Provides support for Balance accounting system based on debit and credit principle

16137.4k](/packages/illuminatech-balance)

PHPackages © 2026

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