php-activerecord is an open source ORM library based on the ActiveRecord pattern.
php-activerecord is no longer actively being maintained, the original site is dead, and the project is mostly abandoned.
I would not recommend this ORM for any new projects or developments.
This fork contains some quality-of-life enhancements and fixes that are relevant to us and some of our older projects.
We recommend using composer:
composer require softwarepunt/php-activerecord:dev-master
Because we do not actively maintain tags or versions for this project, you should refer to
- 👨💻 The original project: https://github.com/jpfuentes2/php-activerecord
- 📕 Mirror of the old docs site: https://www.phpactiverecord.xyz/
(⚠ phpactiverecord.org is dead and being squatted by someone, best to ignore it.)
- Compatibility with PHP 7.2+ (DateTime).
activerecord_autoloadno longer causes conflicts when the library is loaded more than once.
count(): Parameter must be an array or an object that implements Countableerror in
castIntegerSafely()throwing an error if the input is empty (e.g. empty string), now just returns zero.
DateTime: Implement \JsonSerializable, format in "c" mode.
stupidfastquery($options): this converts options to a query and returns the raw PDO result set without any activerecord magic.
stupidfastqueryValues($options, $colIndex = 0): runs a
stupidfastqueryand returns an array of column values.
stupidfastcount($options): run query, only return row count.
find_all_with_wrapped_sort($options): this wraps the results in a separate SELECT for faster sorting on JOIN heavy queries.
find($options)options to get generated query data as result (used internally by
stupidfastcount& co) - can be used if you want to convert
$optionsto an actual statement:
[ 'query' => $sql->to_s(), 'values' => $sql->get_where_values(), 'readonly' => $readonly, 'eager_load' => $eager_load ];