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

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

roxblnfk/cycle-active-record
============================

Cycle Active Record

0.1.1(3y ago)86[3 PRs](https://github.com/roxblnfk/cycle-active-record/pulls)MITPHPPHP &gt;=8.0

Since Mar 20Pushed 2y ago1 watchersCompare

[ Source](https://github.com/roxblnfk/cycle-active-record)[ Packagist](https://packagist.org/packages/roxblnfk/cycle-active-record)[ Docs](https://github.com/roxblnfk/cycle-active-record)[ RSS](/packages/roxblnfk-cycle-active-record/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (10)Versions (6)Used By (0)

Cycle Active Record
===================

[](#cycle-active-record)

[![PHP](https://camo.githubusercontent.com/b7da87530bb72976a1ae6c10566b5a49e1a25ada45c07247ee1e3c05f8851b6c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f726f78626c6e666b2f6379636c652d6163746976652d7265636f72642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/roxblnfk/cycle-active-record)[![Latest Version on Packagist](https://camo.githubusercontent.com/4aa6a3dbb1dc44a814fb2c617d4f4fcfe59acef070c35b5a15698729c761ab87/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f78626c6e666b2f6379636c652d6163746976652d7265636f72642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/roxblnfk/cycle-active-record)[![GitHub Tests Action Status](https://camo.githubusercontent.com/936bf4ea32178153ef5d2c320fa78eef09e58c4ed2bbd8f5edb056650d97fcc7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f726f78626c6e666b2f6379636c652d6163746976652d7265636f72642f72756e2d74657374732e796d6c3f6c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/roxblnfk/cycle-active-record/actions?query=workflow%3Arun-tests+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/1a8a1c56ab39509c84ea69d27d98593d66b7489f4aa8d4a3501f8e252c2d08b4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f78626c6e666b2f6379636c652d6163746976652d7265636f72642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/roxblnfk/cycle-active-record)[![dependency status](https://camo.githubusercontent.com/e9a1fbfcb791291a839a6bd6facd8aa75e690808bd67f99c6da08ce8a787cb54/68747470733a2f2f7068702e7061636b6167652e6865616c74682f7061636b616765732f726f78626c6e666b2f6379636c652d6163746976652d7265636f72642f6465762d6d61737465722f7374617475732e737667)](https://php.package.health/packages/roxblnfk/cycle-active-record/dev-master)

ActiveRecord pattern based on Cycle ORM. AR entities work fine with mappers, repositories, behaviors and other Cycle features.

The package just adds to entity such proxy methods like `save` and `delete` using a class inheritance.

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

[](#requirements)

Make sure that your server is configured with following PHP version and extensions:

- PHP 8.0+
- One of the Cycle ORM adapters:
    - [`spiral/cycle-bridge`](https://github.com/spiral/cycle-bridge) package for the [Spiral Framework](https://github.com/spiral/framework)
    - [`yiisoft/yii-cycle`](https://github.com/yiisoft/yii-cycle) ^2.0 package for the Yii 3

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

[](#installation)

You can install the package via composer:

```
composer require roxblnfk/cycle-active-record
```

After package install you need to register bootloader from the package.

> **Note**If you are installing the package on the Yii 3 or Spiral Framework with the [`spiral-packages/discoverer`](https://github.com/spiral-packages/discoverer) package, then you don't need to register bootloader by yourself. It will be registered automatically.

### Spiral Framework without discoverer

[](#spiral-framework-without-discoverer)

Update Bootloader list

```
protected const LOAD = [
    // ...
    \Cycle\ActiveRecord\Boot\CycleActiveRecordBootloader::class,
];
```

### Custom application

[](#custom-application)

After Container initialization just register it in AR static class:

```
\Cycle\ActiveRecord\StaticOrigin::setContainer($container);
```

Example
-------

[](#example)

Entity:

```
use Cycle\ActiveRecord\ActiveRecord;
use Cycle\Annotated\Annotation\Column;
use Cycle\Annotated\Annotation\Entity;

#[Entity(table: 'user')]
class User extends ActiveRecord
{
    #[Column(type: 'primary', typecast: 'int')]
    public int $id;

    public function __construct(
        #[Column(type: 'string')]
        public string $name
    ) {}
}
```

Usage:

```
$user1 = new User('Lia');
$user2 = new User('Zaza');

// Persisting
$user1->prepare();
$user2->save(); // Save current and prepared entities

// Find and delete
User::findByPK(10)?->delete();

// Delete multiple
$user1->prepareDeletion();
$user2->delete();

// Use SelectQuery
User::find()->where('id', '>', '10')->fetchData();
```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85% 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 ~60 days

Total

2

Last Release

1457d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/110fa17dca123e71e4ef4132d1d6a66d20058a07fc6118e716dd67dd4316e886?d=identicon)[roxblnfk](/maintainers/roxblnfk)

---

Top Contributors

[![roxblnfk](https://avatars.githubusercontent.com/u/4152481?v=4)](https://github.com/roxblnfk "roxblnfk (17 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")

---

Tags

active-recordcycleormactive-recordcycle-orm

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/roxblnfk-cycle-active-record/health.svg)

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

###  Alternatives

[propel/propel

Propel2 is an open-source Object-Relational Mapping (ORM) for PHP.

1.3k5.3M110](/packages/propel-propel)[propel/propel1

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

8481.6M87](/packages/propel-propel1)[j4mie/paris

A lightweight Active Record implementation for PHP5, built on top of Idiorm

989499.6k22](/packages/j4mie-paris)[cycle/active-record

Provides a simple way to work with your database using Active Record pattern and Cycle ORM

671.3k3](/packages/cycle-active-record)[voskobovich/yii2-linker-behavior

This behavior makes it easy to maintain many-to-many and one-to-many relations in your ActiveRecord models.

80319.0k9](/packages/voskobovich-yii2-linker-behavior)[rexshijaku/sql-to-laravel-builder

SQL to Laravel Query Builder

18925.9k1](/packages/rexshijaku-sql-to-laravel-builder)

PHPackages © 2026

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