PHPackages                             explosivebit/yii2-arangodb - 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. explosivebit/yii2-arangodb

ActiveYii2-extension[Database &amp; ORM](/categories/database)

explosivebit/yii2-arangodb
==========================

Yii2 arangodb components

1.0.1(9y ago)03462GPL-3.0+PHP

Since Apr 13Pushed 8y ago1 watchersCompare

[ Source](https://github.com/explosivebit/yii2-arangodb)[ Packagist](https://packagist.org/packages/explosivebit/yii2-arangodb)[ RSS](/packages/explosivebit-yii2-arangodb/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

[Описание на Русском](https://github.com/explosivebit/yii2-arangodb/blob/master/README.RU.md)

ArangoDb Extension for Yii 2
============================

[](#arangodb-extension-for-yii-2)

This extension provides the [ArangoDB](http://www.arangodb.org/) integration for the Yii2 framework.

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

[](#installation)

This extension requires [ArangoDB PHP Extension](https://github.com/triAGENS/ArangoDB-PHP)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist explosivebit/yii2-arangodb "*"

```

or add

```
"explosivebit/yii2-arangodb": "*"

```

to the require section of your composer.json.

General Usage
-------------

[](#general-usage)

To use this extension, simply add the following code in your application configuration:

```
return [
    //....
    'components' => [
        'arangodb' => [
            'class' => '\explosivebit\arangodb\Connection',
            'connectionOptions' => [
                ArangoDBClient\ConnectionOptions::OPTION_DATABASE => "mydatabase",
                ArangoDBClient\ConnectionOptions::OPTION_ENDPOINT => 'tcp://127.0.0.1:8529',
                ArangoDBClient\ConnectionOptions::OPTION_AUTH_TYPE => 'Basic',
                //ArangoDBClient\ConnectionOptions::OPTION_AUTH_USER   => '',
                //ArangoDBClient\ConnectionOptions::OPTION_AUTH_PASSWD => '',
            ],
        ],
    ],
];
```

Using the connection instance you may access databases, collections and documents.

To perform "find" queries, you should use \[\[\\explosivebit\\arangodb\\Query\]\]:

```
use explosivebit\arangodb\Query;

$query = new Query;
// compose the query
$query->select(['name', 'status'])
    ->from('customer')
    ->limit(10);
// execute the query
$rows = $query->all();
```

Using the ArangoDB ActiveRecord
-------------------------------

[](#using-the-arangodb-activerecord)

This extension provides ActiveRecord solution similar ot the \[\[\\yii\\db\\ActiveRecord\]\]. To declare an ActiveRecord class you need to extend \[\[\\explosivebit\\arangodb\\ActiveRecord\]\] and implement the `collectionName` and 'attributes' methods:

```
use explosivebit\arangodb\ActiveRecord;

class Customer extends ActiveRecord
{
    /**
     * @return string the name of the index associated with this ActiveRecord class.
     */
    public static function collectionName()
    {
        return 'customer';
    }

    /**
     * @return array list of attribute names.
     */
    public function attributes()
    {
        return ['_key', 'name', 'email', 'address', 'status'];
    }
}
```

Note: collection primary key name ('\_key') should be always explicitly setup as an attribute.

You can use \[\[\\yii\\data\\ActiveDataProvider\]\] with \[\[\\explosivebit\\arangodb\\Query\]\] and \[\[\\explosivebit\\arangodb\\ActiveQuery\]\]:

```
use yii\data\ActiveDataProvider;
use explosivebit\arangodb\Query;

$query = new Query;
$query->from('customer')->where(['status' => 2]);
$provider = new ActiveDataProvider([
    'query' => $query,
    'pagination' => [
        'pageSize' => 10,
    ]
]);
$models = $provider->getModels();
```

```
use yii\data\ActiveDataProvider;
use app\models\Customer;

$provider = new ActiveDataProvider([
    'query' => Customer::find(),
    'pagination' => [
        'pageSize' => 10,
    ]
]);
$models = $provider->getModels();
```

Using Migrations
----------------

[](#using-migrations)

ArangoDB migrations are managed via \[\[explosivebit\\arangodb\\console\\controllers\\MigrateController\]\], which is an analog of regular \[\[\\yii\\console\\controllers\\MigrateController\]\].

In order to enable this command you should adjust the configuration of your console application:

```
return [
    // ...
    'controllerMap' => [
        'arangodb-migrate' => 'explosivebit\arangodb\console\controllers\MigrateController'
    ],
];
```

Below are some common usages of this command:

```
# creates a new migration named 'create_user_collection'
yii arangodb-migrate/create create_user_collection

# applies ALL new migrations
yii arangodb-migrate

# Apply 1 migration
yii arangodb-migrate/up 1

# reverts the last applied migration
yii arangodb-migrate/down

# Rollback 1 migration
yii arangodb-migrate/down 1

```

Once migration created, you can configure the migration:

When you start the migration as in the example below, you create a normal document collection with the migration name, you need to add an additional parameter `Type => 3` to create the `edge collection`. Example of such a query: `$this-> createCollection ('services', ['Type' => 3] );` If you want to create a document collection, then delete the `'Type' => 3` or replace the number 3 with 2.

```
class m170413_210957_create_services_collection extends \explosivebit\arangodb\Migration
{
    public function up()
    {
        # When you start the migration, a collection of "services" with the edge type is created
        $this->createCollection('services',['Type' => 3]);
    }

    public function down()
    {
        # When the migration rollback starts, the collection "services"
        $this->dropCollection('services');
    }
}
```

Using Debug Panel
-----------------

[](#using-debug-panel)

Add ArangoDb panel to your yii\\debug\\Module configuration

```
return [
    'bootstrap' => ['debug'],
    'modules' => [
        'debug' => 'yii\debug\Module',
        'panels' => [
            'arango' => [
                'class' => 'explosivebit\arangodb\panels\arangodb\ArangoDbPanel',
            ],
        ],
        ...
    ],
    ...
];
```

[![Bitdeli Badge](https://camo.githubusercontent.com/f6d8b691209603a9245635ab1b6eb91ddc2a3f613860a8d1f332820f1b861231/68747470733a2f2f64327765637a68766c38323376302e636c6f756466726f6e742e6e65742f44657647726f75702d72752f796969322d6172616e676f64622f7472656e642e706e67)](https://bitdeli.com/free "Bitdeli Badge")

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 62.3% 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 ~0 days

Total

2

Last Release

3365d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11429206?v=4)[Eli Rum](/maintainers/explosivebit)[@explosivebit](https://github.com/explosivebit)

---

Top Contributors

[![devgen67](https://avatars.githubusercontent.com/u/2807102?v=4)](https://github.com/devgen67 "devgen67 (48 commits)")[![explosivebit](https://avatars.githubusercontent.com/u/11429206?v=4)](https://github.com/explosivebit "explosivebit (13 commits)")[![bethrezen](https://avatars.githubusercontent.com/u/260284?v=4)](https://github.com/bethrezen "bethrezen (12 commits)")[![elfarqy](https://avatars.githubusercontent.com/u/5682478?v=4)](https://github.com/elfarqy "elfarqy (2 commits)")[![bitdeli-chef](https://avatars.githubusercontent.com/u/3092978?v=4)](https://github.com/bitdeli-chef "bitdeli-chef (1 commits)")[![marciocamello](https://avatars.githubusercontent.com/u/4071580?v=4)](https://github.com/marciocamello "marciocamello (1 commits)")

---

Tags

yii2ArangoDb

### Embed Badge

![Health badge](/badges/explosivebit-yii2-arangodb/health.svg)

```
[![Health](https://phpackages.com/badges/explosivebit-yii2-arangodb/health.svg)](https://phpackages.com/packages/explosivebit-yii2-arangodb)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[yii2tech/illuminate

Yii2 to Laravel Migration Package

11415.8k](/packages/yii2tech-illuminate)[mootensai/yii2-relation-trait

Yii 2 Models load with relation, &amp; transaction save with relation

47229.1k9](/packages/mootensai-yii2-relation-trait)[nhkey/yii2-activerecord-history

Storage history of changes to ActiveRecord

45147.2k1](/packages/nhkey-yii2-activerecord-history)[dmstr/yii2-db

Database extensions

19642.9k6](/packages/dmstr-yii2-db)[spanjeta/yii2-backup

Database Backup and Restore functionality

285.3k1](/packages/spanjeta-yii2-backup)

PHPackages © 2026

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