PHPackages                             icanboogie/activerecord - 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. icanboogie/activerecord

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

icanboogie/activerecord
=======================

ActiveRecord Object-relational mapping

v5.0.0(5y ago)125.1k↓84.6%1[5 issues](https://github.com/ICanBoogie/ActiveRecord/issues)5BSD-3-ClausePHPPHP &gt;=7.2CI failing

Since Nov 18Pushed 1y ago3 watchersCompare

[ Source](https://github.com/ICanBoogie/ActiveRecord)[ Packagist](https://packagist.org/packages/icanboogie/activerecord)[ Docs](https://icanboogie.org/)[ RSS](/packages/icanboogie-activerecord/feed)WikiDiscussions 6.0 Synced 3w ago

READMEChangelog (4)Dependencies (5)Versions (15)Used By (5)

Active Record
=============

[](#active-record)

[![Release](https://camo.githubusercontent.com/56a3ab42ade3507553b32cc740b7a28c0b3fc6eb88c94a6125c6e43c7e445d9f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f4943616e426f6f6769652f6163746976657265636f72642e737667)](https://packagist.org/packages/icanboogie/activerecord)[![Code Coverage](https://camo.githubusercontent.com/1373c2f656e268c466d2d4d50f17b3a0eb1f0e722db0dec8bc45b5a86ef5a9ea/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f4943616e426f6f6769652f4163746976655265636f72642e737667)](https://coveralls.io/r/ICanBoogie/ActiveRecord)[![Downloads](https://camo.githubusercontent.com/a997184b7fb200675b5eec5cf0775e3f6e34763c05fddd39d640d8c4f5bb5114/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6963616e626f6f6769652f6163746976657265636f72642e737667)](https://packagist.org/packages/icanboogie/activerecord)

**Connections**, **models** and **active records** are the foundations of everything that concerns database access and management. They are used to establish database connections, manage tables and their possible relationship, as well as manage the records of these tables. Leveraging OOP, the models and active records are instances which properties, getters/setters and behavior can be inherited in a business logic.

Using the **query interface**, you won't have to write raw SQL, manage table relationship, or worry about injection.

Finally, using **providers** you can define all your connections and models in a single place. Connections are established and models are instantiated on demand, so feel free the define hundreds of them.

#### Installation

[](#installation)

```
composer require icanboogie/activerecord
```

### Acknowledgments

[](#acknowledgments)

The implementation of the query interface is vastly inspired by [Ruby On Rails' Active Record Query Interface](http://guides.rubyonrails.org/active_record_querying.html).

Getting started
---------------

[](#getting-started)

Unless you bound **ActiveRecord** to [ICanBoogie](https://icanboogie.org) using the [icanboogie/bind-activerecord](https://github.com/ICanBoogie/bind-activerecord)package, you need to bind the prototype methods `Model::lazy_get_activerecord_cache` and `ActiveRecord::validate`.

The following code should do the trick:

```
