Repository navigation
Version 5.0.0
A model is no longer the record it reads. The library is now three things — a
model that declares the table, a query that reads it and a record that holds the
values. Requires PHP 8.5.
Breaking
Builderis gone, replaced byModel,QueryandRecord. A model no
longer doubles as the row it returns,refresh()on a record is nowfresh().- Relations declare their return type. Only a method returning
Relation
counts as one, so reading a property never runs something else. - Patterns are methods:
whereLike(),whereNotLike(),orWhereLike(),
orWhereNotLike(). Thelikeoperator is no longer accepted bywhere(), and
an unknown operator throws instead of quietly matching nothing. - Sorting takes
SortOrder,SORT_ASCandSORT_DESCare gone. - Pagination is rebuilt and no longer reads
$_GET.CollectionPaginateis
replaced byPaginationandSimplePagination; the page number is passed in:
paginate(10, $page). - Migrations are written as a chain,
createTable()andchangeTable()no
longer take a closure. - A broken cast is an error: a column cast to
arrayorobjectthat does
not hold json throws instead of reading back asnull. Collectionlostkey(),next()andcurrent().- The csv escape character is gone. Files follow RFC 4180: a quote inside a
value is doubled, nothing is escaped with a backslash. A table written by 4.x
whose values end in a backslash may read differently — check such tables
before upgrading.
Added
cursor(), simplePaginate(), constrain() on relations, Record::toArray(),
Collection::keyBy(), and pagination that renders through a template of your own.
Fixed
Writes are atomic and locked, a relation keeps the result its record came from,
count() no longer counts the first row twice, overlapping reads no longer cut
each other short, first() honours offset().
Performance
On 50 000 rows a sorted page holds the page, not the table — 0.6 MB against
33 MB, faster than the same work on plain fopen and fgetcsv. cursor() holds
one record at a time; inserts no longer collect the keys of the table, updates
and deletes no longer read the file twice.
Full changelog with before/after examples: CHANGELOG.md