New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

ankane/tailslide

Median and percentile for Eloquent / Laravel
3,553 2
Install
composer require ankane/tailslide
Latest Version:v0.2.0
PHP:>= 8.1
Laravel:10 · 11
Older releases:9
License:MIT
Last Updated:Aug 26, 2026
Links: GitHub  ·  Packagist
Maintainer: ankane

Tailslide PHP

Median and percentile for Eloquent / Laravel

Supports:

  • PostgreSQL
  • MariaDB
  • MySQL (with an extension)
  • SQL Server

:fire: Uses native functions when possible for blazing performance

Build Status

Installation

Run:

composer require ankane/tailslide

For MySQL, also follow these instructions.

Getting Started

Median

Item::median('price');

Percentile

Request::percentile('response_time', 0.95);

Additional Instructions

MySQL

MySQL requires the PERCENTILE_CONT function from udf_infusion. To install it, do:

git clone https://github.com/infusion/udf_infusion.git
cd udf_infusion
./configure --enable-functions="percentile_cont"
make
sudo make install
mysql <options> < load.sql

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

To get started with development:

git clone https://github.com/ankane/tailslide-php.git
cd tailslide-php
composer install

To run the tests:

# Postgres
createdb tailslide_php_test
ADAPTER=pgsql composer test

# MariaDB
mysqladmin create tailslide_php_test
ADAPTER=mariadb composer test

# MySQL (install the extension first)
mysqladmin create tailslide_php_test
ADAPTER=mysql composer test

# SQL Server
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=YourStrong!Passw0rd' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2022-latest
docker exec -it <container-id> /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P YourStrong\!Passw0rd -Q "CREATE DATABASE tailslide_php_test"
ADAPTER=sqlsrv composer test

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

655,942,320 9,702
laravel/framework

The Laravel Framework.

617,629,957 34,997
laravel/tinker

Powerful REPL for the Laravel framework.

524,145,802 7,444
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

442,489,569 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

412,228,818 4,664

Version History

Version Released PHP Laravel License
v0.2.0 >= 8.1 >= 10 MIT
v0.1.0 >= 8.0 >= 9.0 MIT