laravel-freelancer-nl/arangodb-php-client 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

laravel-freelancer-nl/arangodb-php-client

最新稳定版本:v2.8.0

Composer 安装命令:

composer require laravel-freelancer-nl/arangodb-php-client

包简介

Low level PHP client for ArangoDB

README 文档

README

Low level PHP client for ArangoDB. Supports PHP ^8.0.

Github CI tests Scrutinizer Code Quality Code Coverage Latest Version Total Downloads License

This client is a conduit to ArangoDB and back, so it doesn't make any presumptions on the returned data itself. JSON objects are decoded to POPO's. You can cast those to what you need in your ODM or project.

Install

composer require laravel-freelancer-nl/arangodb-php-client

Quickstart

Create a new client

$client = new ArangoClient($config);

Create a collection

Use the schemaManager to create a new collection.

$client->schema()->createCollection('users');

Get documents from the collection

$statement = $client->prepare('FOR user in Users RETURN user');
$statement->execute();
$users = $statement->fetchAll(); 

As there are no users yet in the above example this will yield an empty result. Note that this client does not have any preconceptions about the data structure and thus everything is returned as raw arrays.

config

The connector has a default configuration for a local ArangoDB instance at it's default port (8529).

AQL statements

To run AQL queries you prepare a query, execute it and fetch the results. Much like PHP's PDO extension.

$statement = $client->prepare('FOR user in users RETURN user');
$statement->execute();
$users = $statement->fetchAll(); 

Alternatively you can traverse over the statement itself to get the results one at a time.

$statement = $client->prepare('FOR user in users RETURN user');
$statement->execute();
foreach ($statement as $document) {
    //
}

Managers

You have access to several managers that allow you to perform specific tasks on your ArangoDB instance(s). Their functions can be called on the manager.

Admin manager

The admin manager manages administrative functions and information retrieval for the server/cluster.

$client->admin()->version();

Monitor manager

The monitor manager manages monitoring functions the server/cluster.

$client->monitor()->getMetrics();

Schema manager

The schema manager manages all schema related operations.

$client->schema()->createDatabase('new_db');

Transaction manager

The transaction manager takes care of all transactions.

$client->transactions()->begin(['write' => ['users', 'teams']]);

Documentation

  1. ArangoDB PHP client
  2. AQL query statements
  3. Admin manager
  4. Monitor manager
  5. Schema manager
    1. Database schema
    2. User schema
    3. Collection schema
    4. Index schema
    5. Graph schema
    6. View schema
    7. Analyzer schema
  6. Transaction manager

Related packages

统计信息

  • 总下载量: 15.17k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 14
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 14
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-03-20