{"id":16170856,"url":"https://github.com/roxblnfk/cycle-active-record","last_synced_at":"2025-07-26T17:06:14.092Z","repository":{"id":43060910,"uuid":"463450924","full_name":"roxblnfk/cycle-active-record","owner":"roxblnfk","description":"ActiveRecord based on Cycle ORM","archived":false,"fork":false,"pushed_at":"2023-11-09T06:04:29.000Z","size":41,"stargazers_count":8,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-19T15:56:56.059Z","etag":null,"topics":["active-record","cycle","orm"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roxblnfk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-25T08:13:35.000Z","updated_at":"2023-08-11T13:01:19.000Z","dependencies_parsed_at":"2022-09-06T08:12:08.243Z","dependency_job_id":"fbadf562-6b80-4c8d-b6a7-7f8af0186be5","html_url":"https://github.com/roxblnfk/cycle-active-record","commit_stats":{"total_commits":14,"total_committers":2,"mean_commits":7.0,"dds":0.0714285714285714,"last_synced_commit":"bc33ea1f9c29f1bd842a7a3d349cd35e87925ebb"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":"spiral-packages/package-skeleton","purl":"pkg:github/roxblnfk/cycle-active-record","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxblnfk%2Fcycle-active-record","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxblnfk%2Fcycle-active-record/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxblnfk%2Fcycle-active-record/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxblnfk%2Fcycle-active-record/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roxblnfk","download_url":"https://codeload.github.com/roxblnfk/cycle-active-record/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxblnfk%2Fcycle-active-record/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267198676,"owners_count":24051559,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["active-record","cycle","orm"],"created_at":"2024-10-10T03:19:47.673Z","updated_at":"2025-07-26T17:06:14.069Z","avatar_url":"https://github.com/roxblnfk.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cycle Active Record\n\n[![PHP](https://img.shields.io/packagist/php-v/roxblnfk/cycle-active-record.svg?style=flat-square)](https://packagist.org/packages/roxblnfk/cycle-active-record)\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/roxblnfk/cycle-active-record.svg?style=flat-square)](https://packagist.org/packages/roxblnfk/cycle-active-record)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/roxblnfk/cycle-active-record/run-tests.yml?label=tests\u0026style=flat-square)](https://github.com/roxblnfk/cycle-active-record/actions?query=workflow%3Arun-tests+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/roxblnfk/cycle-active-record.svg?style=flat-square)](https://packagist.org/packages/roxblnfk/cycle-active-record)\n[![dependency status](https://php.package.health/packages/roxblnfk/cycle-active-record/dev-master/status.svg)](https://php.package.health/packages/roxblnfk/cycle-active-record/dev-master)\n\n\nActiveRecord pattern based on Cycle ORM. AR entities work fine with mappers, repositories, behaviors and other Cycle\nfeatures.\n\nThe package just adds to entity such proxy methods like `save` and `delete` using a class inheritance.\n\n## Requirements\n\nMake sure that your server is configured with following PHP version and extensions:\n\n- PHP 8.0+\n- One of the Cycle ORM adapters:\n  - [`spiral/cycle-bridge`](https://github.com/spiral/cycle-bridge) package for the\n    [Spiral Framework](https://github.com/spiral/framework)\n  - [`yiisoft/yii-cycle`](https://github.com/yiisoft/yii-cycle) ^2.0 package for the Yii 3\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require roxblnfk/cycle-active-record\n```\n\nAfter package install you need to register bootloader from the package.\n\n\u003e **Note**\n\u003e If you are installing the package on the Yii 3 or Spiral Framework with the\n\u003e [`spiral-packages/discoverer`](https://github.com/spiral-packages/discoverer) package,\n\u003e then you don't need to register bootloader by yourself. It will be registered automatically.\n\n### Spiral Framework without discoverer\n\nUpdate Bootloader list\n\n```php\nprotected const LOAD = [\n    // ...\n    \\Cycle\\ActiveRecord\\Boot\\CycleActiveRecordBootloader::class,\n];\n```\n\n### Custom application\n\nAfter Container initialization just register it in AR static class:\n\n```php\n\\Cycle\\ActiveRecord\\StaticOrigin::setContainer($container);\n```\n\n## Example\n\nEntity:\n```php\nuse Cycle\\ActiveRecord\\ActiveRecord;\nuse Cycle\\Annotated\\Annotation\\Column;\nuse Cycle\\Annotated\\Annotation\\Entity;\n\n#[Entity(table: 'user')]\nclass User extends ActiveRecord\n{\n    #[Column(type: 'primary', typecast: 'int')]\n    public int $id;\n\n    public function __construct(\n        #[Column(type: 'string')]\n        public string $name\n    ) {}\n}\n```\n\nUsage:\n\n```php\n$user1 = new User('Lia');\n$user2 = new User('Zaza');\n\n// Persisting\n$user1-\u003eprepare();\n$user2-\u003esave(); // Save current and prepared entities\n\n// Find and delete\nUser::findByPK(10)?-\u003edelete();\n\n// Delete multiple\n$user1-\u003eprepareDeletion();\n$user2-\u003edelete();\n\n// Use SelectQuery\nUser::find()-\u003ewhere('id', '\u003e', '10')-\u003efetchData();\n```\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froxblnfk%2Fcycle-active-record","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froxblnfk%2Fcycle-active-record","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froxblnfk%2Fcycle-active-record/lists"}