PHPackages                             webard/biloquent - 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. webard/biloquent

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

webard/biloquent
================

v1.4.0(2y ago)02.3k1[1 PRs](https://github.com/webard/biloquent/pulls)1MITPHPPHP ^8.1

Since Jan 10Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/webard/biloquent)[ Packagist](https://packagist.org/packages/webard/biloquent)[ RSS](/packages/webard-biloquent/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (15)Versions (15)Used By (1)

BILOQUENT
=========

[](#biloquent)

Reports for Eloquent models.

**Package is under development and in very early stage.**

UDF Infusion
------------

[](#udf-infusion)

Some of aggregator needs [UDF Infusion](https://github.com/infusion/udf_infusion) extensions for MySQL:

- kurtosis
- median
- percentile
- skewness

Sample report
-------------

[](#sample-report)

Sample base on Order model with total and created\_at fields required.

Create file `App\Reports\OrderReport.php`:

```
declare(strict_types=1);

namespace App\Reports;

use Webard\Biloquent\Aggregators\Avg;
use Webard\Biloquent\Aggregators\Count;
use Webard\Biloquent\Report;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use App\Models\User;
use App\Models\Order;

class OrderReport extends Report
{
    public static string $model = Order::class;

    // Defaults if not defined
    public array $grouping = ['year'];
    public array $columns = ['total_orders'];

    // Define needed relations, they are not taken from source model (yet)
    public function customer(): BelongsTo
    {
        return $this->belongsTo(User::class, 'customer_id');
    }

    // Define aggregators
    public function aggregators(): array
    {
         // It is good practice to alias column names, but not necessary
        return [
            'total_orders' => Count::field('total_orders', 'orders.id'),
            'average_amount' => Avg::field('average_amount', 'orders.value'),
        ];
    }

    public function groups(): array
    {
        // It is good practice to alias column names, but not necessary
        return [
            'day' => [
                // aggregator will be applied to report query
                'aggregator' => 'DAY(orders_created_at)',
                // field will be fetched from dataset query
                'field' => 'orders.created_at as orders_created_at'
            ],
            'month' => [
                'aggregator' => 'MONTH(orders_created_at)',
                'field' => 'orders.created_at as orders_created_at'
            ],
            'year' => [
                'aggregator' => 'YEAR(orders_created_at)',
                'field' => 'orders.created_at as orders_created_at'
            ],
            'date' => [
                'aggregator' => 'DATE(orders_created_at)',
                'field' => 'orders.created_at as orders_created_at'
            ],
            'channel_id' => [
                'field' => 'channels.channel_id as channels_channel_id',
                'aggregator' => 'channels_channel_id'
            ],
        ];
    }
}
```

Now you can use report:

```
$report = OrderReport::query()
    // set grouping fields
    ->grouping(['month', 'year'])
    // set which data you want to calculate
    ->summary(['total_orders'])
    // narrow down dataset that you want to calculate
    ->enhance(function($model) {
        $model->whereYear('created_at','>=', '2023');
    })
    // prepare report (this needs to be called before running query)
    ->prepare()
    // get results
    ->get();
```

Example output:

```
[
    0 =>  [
        'year' => 2023,
        'month' => 12,
        'total_orders' => 5,
    ],
    1 =>  [
        'year' => 2024,
        'month' => 4,
        'total_orders' => 2,
    ],
]
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance53

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community10

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

Every ~7 days

Total

13

Last Release

773d ago

Major Versions

v0.0.5 → v1.0.02024-01-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/e34f6439ff69a5e372136c97bf9166d48010bfa7dd29af729e8a6db98d58335d?d=identicon)[webard](/maintainers/webard)

---

Top Contributors

[![webard](https://avatars.githubusercontent.com/u/855788?v=4)](https://github.com/webard "webard (32 commits)")

---

Tags

laraveleloquentbusiness intelligenceBInovareports

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/webard-biloquent/health.svg)

```
[![Health](https://phpackages.com/badges/webard-biloquent/health.svg)](https://phpackages.com/packages/webard-biloquent)
```

###  Alternatives

[watson/validating

Eloquent model validating trait.

9723.3M47](/packages/watson-validating)[silber/bouncer

Eloquent roles and abilities.

3.6k4.4M25](/packages/silber-bouncer)[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)

PHPackages © 2026

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