{"id":14966683,"url":"https://github.com/devgroup-ru/yii2-arangodb","last_synced_at":"2025-07-04T23:04:18.450Z","repository":{"id":17911485,"uuid":"20872734","full_name":"DevGroup-ru/yii2-arangodb","owner":"DevGroup-ru","description":"ArangoDB components for yii2 framework","archived":false,"fork":false,"pushed_at":"2015-02-07T08:49:50.000Z","size":399,"stargazers_count":15,"open_issues_count":2,"forks_count":8,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-01-31T09:22:55.435Z","etag":null,"topics":["activerecord","arango","arangodb","arangodb-activerecord","arangodb-extension","yii2-framework"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DevGroup-ru.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-16T04:29:28.000Z","updated_at":"2022-06-16T08:59:42.000Z","dependencies_parsed_at":"2022-09-02T11:00:23.337Z","dependency_job_id":null,"html_url":"https://github.com/DevGroup-ru/yii2-arangodb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevGroup-ru%2Fyii2-arangodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevGroup-ru%2Fyii2-arangodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevGroup-ru%2Fyii2-arangodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevGroup-ru%2Fyii2-arangodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DevGroup-ru","download_url":"https://codeload.github.com/DevGroup-ru/yii2-arangodb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238183631,"owners_count":19430160,"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":["activerecord","arango","arangodb","arangodb-activerecord","arangodb-extension","yii2-framework"],"created_at":"2024-09-24T13:36:47.902Z","updated_at":"2025-02-10T20:31:32.825Z","avatar_url":"https://github.com/DevGroup-ru.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"ArangoDb Extension for Yii 2\n===========================\n\nThis extension provides the [ArangoDB](http://www.arangodb.org/) integration for the Yii2 framework.\n\n\nInstallation\n------------\n\nThis extension requires [ArangoDB PHP Extension](https://github.com/triAGENS/ArangoDB-PHP)\n\nThe preferred way to install this extension is through [composer](http://getcomposer.org/download/).\n\nEither run\n\n```\nphp composer.phar require --prefer-dist devgroup/yii2-arangodb \"*\"\n```\n\nor add\n\n```\n\"devgroup/yii2-arangodb\": \"*\"\n```\n\nto the require section of your composer.json.\n\n\nGeneral Usage\n-------------\n\nTo use this extension, simply add the following code in your application configuration:\n\n```php\nreturn [\n    //....\n    'components' =\u003e [\n        'arangodb' =\u003e [\n            'class' =\u003e '\\devgroup\\arangodb\\Connection',\n            'connectionOptions' =\u003e [\n                triagens\\ArangoDb\\ConnectionOptions::OPTION_DATABASE =\u003e \"mydatabase\",\n                triagens\\ArangoDb\\ConnectionOptions::OPTION_ENDPOINT =\u003e 'tcp://127.0.0.1:8529',\n                //triagens\\ArangoDb\\ConnectionOptions::OPTION_AUTH_USER   =\u003e '',\n                //triagens\\ArangoDb\\ConnectionOptions::OPTION_AUTH_PASSWD =\u003e '',\n            ],\n        ],\n    ],\n];\n```\n\nUsing the connection instance you may access databases, collections and documents.\n\nTo perform \"find\" queries, you should use [[\\devgroup\\arangodb\\Query]]:\n\n```php\nuse devgroup\\arangodb\\Query;\n\n$query = new Query;\n// compose the query\n$query-\u003eselect(['name', 'status'])\n    -\u003efrom('customer')\n    -\u003elimit(10);\n// execute the query\n$rows = $query-\u003eall();\n```\n\n\nUsing the ArangoDB ActiveRecord\n------------------------------\n\nThis extension provides ActiveRecord solution similar ot the [[\\yii\\db\\ActiveRecord]].\nTo declare an ActiveRecord class you need to extend [[\\devgroup\\arangodb\\ActiveRecord]] and\nimplement the `collectionName` and 'attributes' methods:\n\n```php\nuse devgroup\\arangodb\\ActiveRecord;\n\nclass Customer extends ActiveRecord\n{\n    /**\n     * @return string the name of the index associated with this ActiveRecord class.\n     */\n    public static function collectionName()\n    {\n        return 'customer';\n    }\n\n    /**\n     * @return array list of attribute names.\n     */\n    public function attributes()\n    {\n        return ['_key', 'name', 'email', 'address', 'status'];\n    }\n}\n```\n\nNote: collection primary key name ('_key') should be always explicitly setup as an attribute.\n\nYou can use [[\\yii\\data\\ActiveDataProvider]] with [[\\devgroup\\arangodb\\Query]] and [[\\devgroup\\arangodb\\ActiveQuery]]:\n\n```php\nuse yii\\data\\ActiveDataProvider;\nuse devgroup\\arangodb\\Query;\n\n$query = new Query;\n$query-\u003efrom('customer')-\u003ewhere(['status' =\u003e 2]);\n$provider = new ActiveDataProvider([\n    'query' =\u003e $query,\n    'pagination' =\u003e [\n        'pageSize' =\u003e 10,\n    ]\n]);\n$models = $provider-\u003egetModels();\n```\n\n```php\nuse yii\\data\\ActiveDataProvider;\nuse app\\models\\Customer;\n\n$provider = new ActiveDataProvider([\n    'query' =\u003e Customer::find(),\n    'pagination' =\u003e [\n        'pageSize' =\u003e 10,\n    ]\n]);\n$models = $provider-\u003egetModels();\n```\n\n\nUsing Migrations\n----------------\n\nArangoDB migrations are managed via [[devgroup\\arangodb\\console\\controllers\\MigrateController]], which is an analog of regular\n[[\\yii\\console\\controllers\\MigrateController]].\n\nIn order to enable this command you should adjust the configuration of your console application:\n\n```php\nreturn [\n    // ...\n    'controllerMap' =\u003e [\n        'arangodb-migrate' =\u003e 'devgroup\\arangodb\\console\\controllers\\MigrateController'\n    ],\n];\n```\n\nBelow are some common usages of this command:\n\n```\n# creates a new migration named 'create_user_collection'\nyii arangodb-migrate/create create_user_collection\n\n# applies ALL new migrations\nyii arangodb-migrate\n\n# reverts the last applied migration\nyii arangodb-migrate/down\n```\n\n\nUsing Debug Panel\n-----------------\n\nAdd ArangoDb panel to your yii\\debug\\Module configuration\n\n```php\nreturn [\n    'bootstrap' =\u003e ['debug'],\n    'modules' =\u003e [\n        'debug' =\u003e 'yii\\debug\\Module',\n        'panels' =\u003e [\n            'arango' =\u003e [\n                'class' =\u003e 'devgroup\\arangodb\\panels\\arangodb\\ArangoDbPanel',\n            ],\n        ],\n        ...\n    ],\n    ...\n];\n```\n\n\n[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/DevGroup-ru/yii2-arangodb/trend.png)](https://bitdeli.com/free \"Bitdeli Badge\")\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevgroup-ru%2Fyii2-arangodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevgroup-ru%2Fyii2-arangodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevgroup-ru%2Fyii2-arangodb/lists"}