Download the PHP package nalabdou/algebra-php without Composer
On this page you can find all versions of the php package nalabdou/algebra-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nalabdou/algebra-php
More information about nalabdou/algebra-php
Files in nalabdou/algebra-php
Package algebra-php
Short Description Pure PHP relational algebra engine — JOIN, PIVOT, WINDOW, GROUP BY, 60+ operations. Zero dependencies.
License MIT
Informations about the package algebra-php
algebra-php
Pure PHP relational algebra engine.
JOIN · PIVOT · WINDOW · GROUP BY · 60+ operations · Zero framework dependency.
Why algebra-php?
You have two arrays from Doctrine, an API response, or a CSV file. You need to join them, group them, compute running totals, and build a pivot table — all in PHP, all in one readable pipeline.
Without algebra you write nested loops, multiple array_filter calls, manual aggregation, and bespoke pivot code spread across multiple methods. With algebra-php you write this:
Installation
Requires PHP 8.2+.
Quick start
All operations
Entry point
Joins
Set operations
Filter & projection
Grouping & aggregation
Window functions
Pivot
Sorting & slicing
Structural operations
Terminal operations
Expression language
String expressions use ExpressionLanguage. The row is exposed as item:
Built-in functions: length, lower, upper, trim, abs, round, contains.
Closures are always supported and run with zero ExpressionLanguage overhead:
Pipeline branching
Pipelines are immutable — pipe() always returns a new instance. Branch freely:
Query planner
The QueryPlanner automatically rewrites the declared operation order before execution. Filters are pushed before joins, redundant sorts eliminated, consecutive maps collapsed — without changing the result.
Inspect the plan:
Execution log
Every MaterializedCollection carries a per-operation execution log:
Custom aggregates
Custom adapters
Register in a custom CollectionFactory or use the framework bundles:
nalabdou/algebra-symfony— Symfony bundle with Doctrine, Profiler, Commandsnalabdou/algebra-laravel— [Comming soon] Laravel Service Provider, Eloquent macros, Artisannalabdou/algebra-twig— [Comming soon] All operations as Twig filters
Parallel execution
Running the demos
Running tests
Architecture
Versioning
MAJOR.MINOR.FIX — Versioning follows this scheme:
- MAJOR – Incremented for breaking changes.
- MINOR – Incremented on a regular monthly release. Adds new features in a backward-compatible way.
- FIX – Incremented on demand for bug fixes, documentation updates, or minor improvements.
License
MIT — Nadim Al Abdou