PHPackages                             yii1x/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. yii1x/active-record

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

yii1x/active-record
===================

Yii 1.1 Active Record, extracted and modernized for PHP 8.4+

0.1.0(1mo ago)110PHPPHP ^8.4

Since May 12Pushed 1mo agoCompare

[ Source](https://github.com/yiiex/active-record)[ Packagist](https://packagist.org/packages/yii1x/active-record)[ RSS](/packages/yii1x-active-record/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

Yii1x Active Record
===================

[](#yii1x-active-record)

> Yii 1.1 Active Record, extracted and modernized for PHP 8.4+.

Familiar API. Zero framework lock-in.

[![Packagist](https://camo.githubusercontent.com/e97d4b157511fd40f8c7d15baa3de990b353be4d2aa2878ab8656e11f1627147/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f79696931782f6163746976652d7265636f7264)](https://packagist.org/packages/yii1x/active-record)[![License](https://camo.githubusercontent.com/34ea0caef8ddf5fdc795a571e64da468aa7f8f9666d207418f4332c2055046d9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f79696931782f6163746976652d7265636f7264)](https://packagist.org/packages/yii1x/active-record)

---

What is it?
-----------

[](#what-is-it)

This package is the Active Record component from **Yii 1.1**, extracted and refactored to run on **PHP 8.4+** without requiring the full Yii framework.

- ✅ Same API you know from Yii 1
- ✅ PHP 8 types and attributes support
- ✅ No `Yii::app()` dependency
- ✅ Works with any PSR-11 compatible container

---

Requirements
------------

[](#requirements)

- PHP ≥ 8.4
- PSR-11 `ContainerInterface` (required)
- Optional PSR dependencies (if used in your app):
    - `Psr\Log\LoggerInterface`
    - `Psr\SimpleCache\CacheInterface`
    - `Psr\EventDispatcher\EventDispatcherInterface`

---

Installation
------------

[](#installation)

```
composer require yii1x/active-record
```

---

Bootstrap
---------

[](#bootstrap)

Before using any model, initialize the ORM context once per application lifecycle:

```
use Yii1x\ActiveRecord\ORMContext;

ORMContext::bootstrap($container, debug: false);
```

Where `$container` is your PSR-11 container.

The container must be able to return a **configured database connection instance** by name (e.g., `'db'` or `'yourDbName'`).

This can be:

- An instance of `Yii1x\ActiveRecord\Db\DbConnection`
- Any class extending `DbConnection`

---

### Example configuration (from Yii 3):

[](#example-configuration-from-yii-3)

```
