Download the PHP package abordage/eloquent-percentile without Composer
On this page you can find all versions of the php package abordage/eloquent-percentile. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download abordage/eloquent-percentile
More information about abordage/eloquent-percentile
Files in abordage/eloquent-percentile
Package eloquent-percentile
Short Description Laravel Eloquent withMedian(), withPercentile(), median() and percentile() aggregate functions
License MIT
Homepage https://github.com/abordage/eloquent-percentile
Informations about the package eloquent-percentile
Laravel Eloquent withMedian, withPercentile, median and percentile aggregate functions for PostgeSQL
The package provides several aggregate functions that work in the same way as withAvg()
, withMax()

Requirements
- PHP 7.4 - 8.3
- Laravel 8.x - 11.x
Supports:
- PostgreSQL
Installation
You can install the package via composer:
Usage
Aggregating Related Models
The method withMedian()
will place a {relation}_median_{column}
attribute on your resulting models:
The method withPercentile()
will place a {relation}_percentile{percentile*100}_{column}
attribute on your resulting models:
Retrieving Aggregates
When interacting with Eloquent models, you may also use the percentile
and median
aggregate methods.
As you might expect, these methods return a scalar value instead of an Eloquent model instance:
Automatic PHPDocs for models
If you are using the ide-helper you can describe the attributes with the Model Hooks. For example:
Testing
Before running the tests, rename the phpunit.xml.dist
to phpunit.xml
and specify your database connection settings:
Next run:
or
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
Please review our security policy on how to report security vulnerabilities.
Feedback
Find a bug or have a feature request? Open an issue, or better yet, submit a pull request - contribution welcome!
Credits
Thanks to
The original idea comes from the tailslide-php, so many thanks to its author!
License
The MIT License (MIT). Please see License File for more information.