{"id":28635433,"url":"https://github.com/dmstr/yii2-db","last_synced_at":"2025-06-12T17:10:18.875Z","repository":{"id":18299694,"uuid":"21474885","full_name":"dmstr/yii2-db","owner":"dmstr","description":"Database extensions for Yii 2.0 Framework :package:","archived":false,"fork":false,"pushed_at":"2023-01-24T20:50:59.000Z","size":151,"stargazers_count":18,"open_issues_count":1,"forks_count":9,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-05-10T21:48:21.997Z","etag":null,"topics":["access-control","behavior","data-dump","dmstr","mysql","trait","yii2"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dmstr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-03T19:45:17.000Z","updated_at":"2025-04-16T19:02:19.000Z","dependencies_parsed_at":"2023-02-14T01:15:26.373Z","dependency_job_id":null,"html_url":"https://github.com/dmstr/yii2-db","commit_stats":null,"previous_names":[],"tags_count":74,"template":false,"template_full_name":null,"purl":"pkg:github/dmstr/yii2-db","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmstr%2Fyii2-db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmstr%2Fyii2-db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmstr%2Fyii2-db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmstr%2Fyii2-db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmstr","download_url":"https://codeload.github.com/dmstr/yii2-db/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmstr%2Fyii2-db/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259509474,"owners_count":22868837,"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","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":["access-control","behavior","data-dump","dmstr","mysql","trait","yii2"],"created_at":"2025-06-12T17:10:14.514Z","updated_at":"2025-06-12T17:10:18.857Z","avatar_url":"https://github.com/dmstr.png","language":"PHP","readme":"Yii 2 Database Toolkit\n======================\n\n[![Latest Stable Version](https://poser.pugx.org/dmstr/yii2-db/v/stable.svg)](https://packagist.org/packages/dmstr/yii2-db) \n[![Total Downloads](https://poser.pugx.org/dmstr/yii2-db/downloads.svg)](https://packagist.org/packages/dmstr/yii2-db)\n[![License](https://poser.pugx.org/dmstr/yii2-db/license.svg)](https://packagist.org/packages/dmstr/yii2-db)\n\nAbout\n-----\n\n\n### [dmstr\\db\\behaviors\\HydratedAttributes](https://github.com/dmstr/yii2-db/blob/master/db/behaviors/HydratedAttributes.php)\n\nRetrieves all eager loaded attributes of a model including relations. Once the extension is installed, simply use it in your code by accessing the corresponding classes by their full namespaced path.\n\n### [dmstr\\db\\mysql\\FileMigration](https://github.com/dmstr/yii2-db/blob/master/db/mysql/FileMigration.php)\n\nruns database migrations from `sql` files\n\n\n- Generic database exentsions\n  - Hydrated Attributes\n- Database extensions for MySQL\n  - File Migration\n  - Mysql dump/export/import console controller\n- RBAC migrations moved to https://github.com/dmstr/yii2-rbac-migration since 2.0.0\n- Active record access classes moved to https://github.com/dmstr/yii2-active-record-permissions since 2.0.0\n\n\nInstallation\n------------\n\nThe preferred way to install this extension is through [composer](http://getcomposer.org/download/).\n\nEither run\n\n```\ncomposer require --prefer-dist dmstr/yii2-db \"*\"\n```\n\nor add\n\n```\n\"dmstr/yii2-db\": \"*\"\n```\n\nto the require section of your `composer.json` file.\n\nConfiguration\n-------------\n\n### [dmstr\\console\\controllers](https://github.com/dmstr/yii2-db/blob/master/console/controllers)\n\nInclude it in your console configuration\n\n```\n   'controllerMap' =\u003e [\n        'db'         =\u003e [\n            'class' =\u003e 'dmstr\\console\\controllers\\MysqlController',\n            'noDataTables' =\u003e [\n                'app_log',\n                'app_session',\n            ]\n        ],\n    ],\n```\n\nUsage\n-----\n\n### Commands\n\n#### `yii migrate ...`\n\nCreate a file migration class\n\n```\nyii migrate/create \\\n    --templateFile='@vendor/dmstr/yii2-db/db/mysql/templates/file-migration.php' init_dump\n```\n\n\n#### `yii db ...`\n\n```\nDESCRIPTION\n\nMySQL database maintenance command for current (db) connection\n\n\nSUB-COMMANDS\n\n- db/create               Create schema\n- db/destroy              Remove schema\n- db/dump                 Dump schema (all tables)\n- db/export               Export tables (INSERT only)\n- db/import               Import from file to database and flush cache\n- db/index (default)      Displays tables in database\n- db/wait-for-connection\n\nTo see the detailed information about individual sub-commands, enter:\n\n  yii help \u003csub-command\u003e\n\n```\n\n\nShow help\n\n```\nyii help db\n```\n\n\n### Examples\n\nDry-run command (not available for all commands)\n\n```\nyii db/create root secret -n\n```\n\nDestroy database\n\n```\nyii db/destroy root secret\n```\n\nDump all tables\n\n```\nyii db/dump -o /dumps\n```\n\nDump from different connection, exclude logging tables\n\n``` \nyii db/dump -o /dumps \\\n  --db=dbReadonly \\\n  --noDataTables=app_audit_data,app_audit_entry,app_audit_error,app_audit_javascript,app_audit_mail\n```\n\nDump from secondary connection, import into primary (default)\n\n```\nyii db/dump -o /dumps   \\\n    --db=dbReadonly   \\\n    --noDataTables=app_audit_data,app_audit_entry,app_audit_error,app_audit_javascript,app_audit_mail \\\n | xargs yii db/import --interactive=0\n```\n\n\n---\n\nBuilt by [dmstr](http://diemeisterei.de)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmstr%2Fyii2-db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmstr%2Fyii2-db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmstr%2Fyii2-db/lists"}