PHPackages                             anax/database-active-record - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. anax/database-active-record

ActiveLibrary[Database &amp; ORM](/categories/database)

anax/database-active-record
===========================

Anax Database Active Record module for model classes.

v2.0.4(6y ago)06.2k↓91.7%7MITPHPPHP &gt;=7.2CI failing

Since Dec 10Pushed 6y ago1 watchersCompare

[ Source](https://github.com/canax/database-active-record)[ Packagist](https://packagist.org/packages/anax/database-active-record)[ Docs](https://dbwebb.se/anax)[ RSS](/packages/anax-database-active-record/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (2)Versions (6)Used By (7)

Anax Database Active Record
===========================

[](#anax-database-active-record)

[![Latest Stable Version](https://camo.githubusercontent.com/68f3e58b0e9c66635c7d6092863c5853eb5b9b54c987652d239db0edd3c094dc/68747470733a2f2f706f7365722e707567782e6f72672f616e61782f64617461626173652d6163746976652d7265636f72642f762f737461626c65)](https://packagist.org/packages/anax/database-active-record)[![Join the chat at https://gitter.im/canax/database-active-record](https://camo.githubusercontent.com/7e3b1d4e7e64368c397da3d45a7e83ac4e30c66a90a78b58044f81a1b3e352a8/68747470733a2f2f6261646765732e6769747465722e696d2f63616e61782f64617461626173652d6163746976652d7265636f72642e737667)](https://gitter.im/canax/database-active-record?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![Build Status](https://camo.githubusercontent.com/84ef42bc078c68e2ca6e0acc2f54fb3bb89f30d1431286f8b99b8e75e87bf13b/68747470733a2f2f7472617669732d63692e6f72672f63616e61782f64617461626173652d6163746976652d7265636f72642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/canax/database-active-record)[![CircleCI](https://camo.githubusercontent.com/8794020f835ba96a9159eb5a97ae17ae2927229708f82b9e2af52e9288d0e7e8/68747470733a2f2f636972636c6563692e636f6d2f67682f63616e61782f64617461626173652d6163746976652d7265636f72642e7376673f7374796c653d737667)](https://circleci.com/gh/canax/database-active-record)

[![Build Status](https://camo.githubusercontent.com/653022a2c973667b1b9aa12c112cf8d7769092662c347f79a7031397d396b351/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f63616e61782f64617461626173652d6163746976652d7265636f72642f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/canax/database-active-record/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/89ede4e614b56f4c360b84025c1a20b02e8cffdd9063142ff7e2842282a8d4eb/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f63616e61782f64617461626173652d6163746976652d7265636f72642f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/canax/database-active-record/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/aeef7d70893413326f4c8df90c39b7b4fc5d5c9faa5bae6379cc7896c0a179ff/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f63616e61782f64617461626173652d6163746976652d7265636f72642f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/canax/database-active-record/?branch=master)

[![Maintainability](https://camo.githubusercontent.com/946792c3b282bfa243a3c0f47000b95d8fc9215667cc20de52be464a4bc936de/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f61623063346434373235363564393565363466662f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/canax/database-active-record/maintainability)[![Codacy Badge](https://camo.githubusercontent.com/10cc4009e476d29c979750f06bdeb0f0fb22bb812a0de7dfc9eafc9a43dab7e3/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3664666636303434643235363436653962636165613361333333313038646564)](https://www.codacy.com/app/mosbth/database-active-record?utm_source=github.com&utm_medium=referral&utm_content=canax/database-active-record&utm_campaign=Badge_Grade)

Anax Database Active Record module is an implementation of the Active Record design pattern for model classes using a database.

The implementation uses the module [`anax\database-query-builder`](https://github.com/canax/database-query-builder) which builds upon the module [`anax\database`](https://github.com/canax/database).

The module is tested using MySQL and SQLite.

Table of content
----------------

[](#table-of-content)

- [Class, interface, trait](#class-interface-trait)
- [Exceptions](#exceptions)
- [Basic usage](#basic-usage)
- [Dependency](#Dependency)
- [License](#License)

Class, interface, trait
-----------------------

[](#class-interface-trait)

The following classes, interfaces and traits exists.

Class, interface, traitDescription`Anax\Database\ActiveRecordModel`An Active Record implementation using the Anax Database Query Builder.Exceptions
----------

[](#exceptions)

All exceptions are in the namespace `Anax\DatabaseActiveRecord\Exception\`. The following exceptions exists and may be thrown.

ExceptionDescription`ActiveRecordException`General module specific exception.Basic usage
-----------

[](#basic-usage)

The Active Record design pattern is implemented through the class `Anax\DatabaseActiveRecord\DatabaseActiveRecord`. A model class which wants to use the implementation should extend this class to get access to the methods implementing Active Record usage.

Dependency
----------

[](#dependency)

This module depends upon, and extends, the database abstraction layer [`anax\database`](https://github.com/canax/database).

The module is usually used within an Anax installation but can also be used without Anax.

License
-------

[](#license)

This software carries a MIT license. See [LICENSE.txt](LICENSE.txt) for details.

```
 .
..:  Copyright (c) 2013 - 2018 Mikael Roos, mos@dbwebb.se

```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~91 days

Total

5

Last Release

2385d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4cac244120f54c02a4fb3186b91323f3f0805dd9daefd0babeb4a82a19232faf?d=identicon)[mikael\_roos](/maintainers/mikael_roos)

---

Top Contributors

[![mosbth](https://avatars.githubusercontent.com/u/169550?v=4)](https://github.com/mosbth "mosbth (11 commits)")

---

Tags

databaseactive-recordquery builderdba

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/anax-database-active-record/health.svg)

```
[![Health](https://phpackages.com/badges/anax-database-active-record/health.svg)](https://phpackages.com/packages/anax-database-active-record)
```

###  Alternatives

[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[usmanhalalit/pixie

A lightweight, expressive, framework agnostic query builder for PHP.

6872.2M16](/packages/usmanhalalit-pixie)[foolz/sphinxql-query-builder

A PHP query builder for SphinxQL and ManticoreQL with MySQLi and PDO drivers.

3232.2M33](/packages/foolz-sphinxql-query-builder)[ezsql/ezsql

Advance database access library. Make interacting with a database ridiculously easy. An universal interchangeable CRUD system.

86848.3k](/packages/ezsql-ezsql)[lulco/phoenix

Database Migrations for PHP

179341.0k4](/packages/lulco-phoenix)[cycle/database

DBAL, schema introspection, migration and pagination

65746.2k48](/packages/cycle-database)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
