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 5mo ago1 watchersCompare

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

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 81% of packages

Maintenance49

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

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

818d ago

Major Versions

v0.0.5 → v1.0.02024-01-10

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/855788?v=4)[Bartłomiej Gajda](/maintainers/webard)[@webard](https://github.com/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

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M188](/packages/laravel-ai)[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M94](/packages/mongodb-laravel-mongodb)[illuminate/database

The Illuminate Database package.

2.8k54.9M11.5k](/packages/illuminate-database)[watson/validating

Eloquent model validating trait.

9803.5M53](/packages/watson-validating)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)

PHPackages © 2026

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