{"id":14966392,"url":"https://github.com/yiisoft/active-record","last_synced_at":"2026-02-28T17:00:48.420Z","repository":{"id":37793432,"uuid":"143600061","full_name":"yiisoft/active-record","owner":"yiisoft","description":"Active Record pattern implementation","archived":false,"fork":false,"pushed_at":"2026-02-22T10:47:29.000Z","size":1591,"stargazers_count":117,"open_issues_count":35,"forks_count":36,"subscribers_count":22,"default_branch":"master","last_synced_at":"2026-02-22T11:51:43.235Z","etag":null,"topics":["active-record","activerecord","database","hacktoberfest","yii3"],"latest_commit_sha":null,"homepage":"https://www.yiiframework.com/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yiisoft.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"open_collective":"yiisoft","github":["yiisoft"],"polar":"yiisoft"}},"created_at":"2018-08-05T09:34:14.000Z","updated_at":"2026-02-22T03:55:19.000Z","dependencies_parsed_at":"2024-04-15T09:05:31.503Z","dependency_job_id":"2c1f30ee-211d-491a-9117-039663e27469","html_url":"https://github.com/yiisoft/active-record","commit_stats":{"total_commits":311,"total_committers":28,"mean_commits":"11.107142857142858","dds":0.7684887459807074,"last_synced_commit":"431d5d3bff7550eaabfad175f57c47e4d5bb9436"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/yiisoft/active-record","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Factive-record","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Factive-record/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Factive-record/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Factive-record/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yiisoft","download_url":"https://codeload.github.com/yiisoft/active-record/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Factive-record/sbom","scorecard":{"id":627633,"data":{"date":"2025-08-11","repo":{"name":"github.com/yiisoft/active-record","commit":"2d28e9a6d6cc38cb2391e22135a07bb54614fb97"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":6.3,"checks":[{"name":"Maintained","score":10,"reason":"20 commit(s) and 3 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":9,"reason":"Found 28/30 approved changesets -- score normalized to 9","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T06:55:40.025Z","repository_id":37793432,"created_at":"2025-08-21T06:55:40.026Z","updated_at":"2025-08-21T06:55:40.026Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29943631,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T13:49:17.081Z","status":"ssl_error","status_checked_at":"2026-02-28T13:48:50.396Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","activerecord","database","hacktoberfest","yii3"],"created_at":"2024-09-24T13:36:18.998Z","updated_at":"2026-02-28T17:00:48.375Z","avatar_url":"https://github.com/yiisoft.png","language":"PHP","readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/yiisoft\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://yiisoft.github.io/docs/images/yii_logo.svg\" height=\"100px\" alt=\"Yii\"\u003e\n    \u003c/a\u003e\n    \u003ch1 align=\"center\"\u003eYii Active Record\u003c/h1\u003e\n    \u003cbr\u003e\n\u003c/p\u003e\n\n[![Latest Stable Version](https://poser.pugx.org/yiisoft/active-record/v)](https://packagist.org/packages/yiisoft/active-record)\n[![Total Downloads](https://poser.pugx.org/yiisoft/active-record/downloads)](https://packagist.org/packages/yiisoft/active-record)\n[![Code Coverage](https://codecov.io/gh/yiisoft/active-record/branch/master/graph/badge.svg)](https://codecov.io/gh/yiisoft/active-record)\n[![Mutation testing badge](https://img.shields.io/endpoint?style=flat\u0026url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyiisoft%2Factive-record%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/active-record/master)\n[![Static analysis](https://github.com/yiisoft/active-record/actions/workflows/static.yml/badge.svg?branch=master)](https://github.com/yiisoft/active-record/actions/workflows/static.yml?query=branch%3Amaster)\n[![type-coverage](https://shepherd.dev/github/yiisoft/active-record/coverage.svg)](https://shepherd.dev/github/yiisoft/active-record)\n[![psalm-level](https://shepherd.dev/github/yiisoft/active-record/level.svg)](https://shepherd.dev/github/yiisoft/active-record)\n\nThis package provides [Active Record pattern](https://en.wikipedia.org/wiki/Active_record_pattern) implementation.\n\nSupported databases:\n\n| Packages                                                   | Build status                                                                                                                                                                                                        |\n|------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Microsft SQL Server](https://github.com/yiisoft/db-mssql) | [![Build status](https://github.com/yiisoft/active-record/actions/workflows/db-mssql.yml/badge.svg?branch=master)](https://github.com/yiisoft/active-record/actions/workflows/db-mssql.yml?query=branch%3Amaster)   |\n| [MySQL](https://github.com/yiisoft/db-mysql)               | [![Build status](https://github.com/yiisoft/active-record/actions/workflows/db-mysql.yml/badge.svg?branch=master)](https://github.com/yiisoft/active-record/actions/workflows/db-mysql.yml?query=branch%3Amaster)   |\n| [Oracle](https://github.com/yiisoft/db-oracle)             | [![Build status](https://github.com/yiisoft/active-record/actions/workflows/db-oracle.yml/badge.svg?branch=master)](https://github.com/yiisoft/active-record/actions/workflows/db-oracle.yml?query=branch%3Amaster) |\n| [PostgreSQL](https://github.com/yiisoft/db-pgsql)          | [![Build status](https://github.com/yiisoft/active-record/actions/workflows/db-pgsql.yml/badge.svg?branch=master)](https://github.com/yiisoft/active-record/actions/workflows/db-pgsql.yml?query=branch%3Amaster)   |\n| [SQLite](https://github.com/yiisoft/db-sqlite)             | [![Build status](https://github.com/yiisoft/active-record/actions/workflows/db-sqlite.yml/badge.svg?branch=master)](https://github.com/yiisoft/active-record/actions/workflows/db-sqlite.yml?query=branch%3Amaster) |\n\n## Requirements\n\n- PHP 8.1 - 8.5.\n\n## Installation\n\nThe package could be installed with [Composer](https://getcomposer.org):\n\n```shell\ncomposer require yiisoft/active-record\n```\n\n\u003e [!IMPORTANT]\n\u003e See also [installation notes](https://github.com/yiisoft/db/?tab=readme-ov-file#documentation) for `yiisoft/db`\n\u003e package.\n\nAfter installing `yiisoft/active-record`, you also need to configure a database connection:\n\n1. Configure the connection, follow [Yii Database](https://github.com/yiisoft/db/blob/master/docs/guide/en/README.md)\nguide.\n2.  [Define the Database Connection for Active Record](docs/define-connection.md)\n\n## General usage\n\nDefined your active record class (for more information, follow [Create Active Record Model](docs/create-model.md) guide):\n\n```php\nfinal class User extends \\Yiisoft\\ActiveRecord\\ActiveRecord\n{\n    public int $id;\n    public string $username;\n    public string $email;\n    public string $status = 'active';\n\n    public function tableName(): string\n    {\n        return '{{%user}}';\n    }\n}\n```\n\nFor fast prototyping you can use dynamic properties by adding `#[\\AllowDynamicProperties]` attribute:\n\n```php\n/**\n * Database fields:\n * @property int $id\n * @property string $username\n * @property string $email\n * @property string $status\n **/\n#[\\AllowDynamicProperties]\nfinal class User extends \\Yiisoft\\ActiveRecord\\ActiveRecord\n{\n}\n```\n\nNow you can use the active record:\n\n```php\n// Creating a new record\n$user = new User();\n$user-\u003eusername = 'alexander-pushkin';\n$user-\u003eemail = 'pushkin@example.com';\n$user-\u003esave();\n\n// Retrieving a record\n$user = User::query()-\u003efindByPk(1);\n\n// Read properties\n$username = $user-\u003eusername;\n$email = $user-\u003eemail;\n```\n\n## Documentation\n\n- [Define the Database Connection for Active Record](docs/define-connection.md)\n- [Create Active Record Model](docs/create-model.md)\n- [Define Active Record Relations](docs/define-relations.md)\n- [Extending Functionality With Traits](docs/traits/traits.md)\n- [Using Dependency Injection With Active Record Model](docs/using-di.md)\n- [Optimistic Locking](docs/optimistic-locking.md)\n- [Internals](docs/internals.md)\n\nIf you need help or have a question, the [Yii Forum](https://forum.yiiframework.com/c/yii-3-0/63) is a good place\nfor that. You may also check out other [Yii Community Resources](https://www.yiiframework.com/community).\n\n## License\n\nThe Yii Active Record is free software. It is released under the terms of the BSD License.\nPlease see [`LICENSE`](./LICENSE.md) for more information.\n\nMaintained by [Yii Software](https://www.yiiframework.com/).\n\n## Support the project\n\n[![Open Collective](https://img.shields.io/badge/Open%20Collective-sponsor-7eadf1?logo=open%20collective\u0026logoColor=7eadf1\u0026labelColor=555555)](https://opencollective.com/yiisoft)\n\n## Follow updates\n\n[![Official website](https://img.shields.io/badge/Powered_by-Yii_Framework-green.svg?style=flat)](https://www.yiiframework.com/)\n[![Twitter](https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter\u0026logoColor=1DA1F2\u0026labelColor=555555?style=flat)](https://twitter.com/yiiframework)\n[![Telegram](https://img.shields.io/badge/telegram-join-1DA1F2?style=flat\u0026logo=telegram)](https://t.me/yii3en)\n[![Facebook](https://img.shields.io/badge/facebook-join-1DA1F2?style=flat\u0026logo=facebook\u0026logoColor=ffffff)](https://www.facebook.com/groups/yiitalk)\n[![Slack](https://img.shields.io/badge/slack-join-1DA1F2?style=flat\u0026logo=slack)](https://yiiframework.com/go/slack)\n","funding_links":["https://opencollective.com/yiisoft","https://github.com/sponsors/yiisoft","https://polar.sh/yiisoft"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiisoft%2Factive-record","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyiisoft%2Factive-record","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiisoft%2Factive-record/lists"}