oihana/php-arango
最新稳定版本:1.0.0
Composer 安装命令:
composer require oihana/php-arango
包简介
Composable PHP toolkit for ArangoDB. Bundles a modern HTTP client (collections, documents, edges, AQL, cursors, indexes, transactions, graphs, analyzers, views), a high-level façade, document/edge models with trait-based composition, controllers, helpers and CLI commands.
关键字:
README 文档
README
Composable PHP toolkit for ArangoDB. Part of the Oihana PHP ecosystem, this package bundles a modern HTTP client, a high-level façade, document/edge models, controllers, helpers and CLI commands — everything you need to build an ArangoDB-backed application end-to-end.
📚 Documentation
Full API reference (generated with phpDocumentor): https://bcommebois.github.io/oihana-php-arango
User guides (FR + EN) live under wiki/. A few entry points:
- Getting started — concepts and dependencies.
- Search & filtering — the
?search=/?filter=/?facets=query DSL. - Testing — unit tests, code coverage and the live smoke tests.
- Contributing — setup, conventions and the PR workflow.
📦 Installation
Requires PHP 8.4+ and an ArangoDB 3.11+ server. Install via Composer:
composer require oihana/php-arango
✨ What you can do
- Talk to ArangoDB through a modern, ready-to-use HTTP client built on Guzzle — Basic + JWT/Bearer authentication, automatic 401 refresh, cluster failover, retry on transient errors.
- Run AQL queries with safe placeholder binding (
aql()helper), anAqlBuilderfor fluent assembly, and a lazyCursorsupportingmap / forEach / reduce / flatMap. - Manage collections, documents, edges and indexes — full CRUD, batch operations, bulk JSON-Lines import, 7 typed index types (
PersistentIndex,GeoIndex,TtlIndex,FulltextIndex,MdiIndex,VectorIndex,InvertedIndex). - Use transactions, graphs, analyzers and views — streaming transactions with
withTransaction()auto-commit/abort, gharial-based graphs with typed vertex/edge collections, ArangoSearch analyzers and views (full-textSEARCH,PHRASE,BM25). - Compose document models via fine-grained traits (CRUD, AQL helpers, signals before/after CRUD).
- Plug controllers into any Slim-compatible PSR-15 stack with
DocumentsController+ capability gating. - Drive list queries from the URL — a declarative
?search=,?filter=and?facets=DSL on document models that compiles to safe, bound AQL: rich comparators,AND/OR/NOT, range (between) and array quantifiers (quant,AT LEAST), hierarchical field paths, edge/join facets, plus output-sidealtprojection transforms. - Run live smoke tests against a real
arangodvia the built-inarango:test:clientsandarango:test:facadeconsole commands.
Under the hood
- A consistent set of value objects and enums — no magic strings.
- Pure-PHP transport based on GuzzleHttp v7.
- Helpers for PSR-11 Container wiring.
- Hydration delegated to
oihana/php-reflect— the client returns array data by default, the high-level façade hydrates into typed objects. - Casbin RBAC adapter for ArangoDB included (
oihana\arango\casbin\ArangoCasbinAdapter).
✅ Running tests
Run all tests:
composer test
Run a specific test file:
composer test ./tests/oihana/arango/SomeTest.php
Code coverage
Measure how much of ./src the suite exercises (requires Xdebug or PCOV):
composer coverage # text + Clover + HTML report under build/coverage/ composer coverage:md # readable Markdown summary at build/coverage/COVERAGE.md
The build/ output is gitignored — regenerate it on demand rather than committing a snapshot. See the testing guide for the full workflow.
Live smoke tests against a real arango database
The package ships with two end-to-end smoke tests that exercise every public surface against a live ArangoDB server. They operate on an ephemeral database that is created and dropped per run, so production data is never touched.
# Copy the example config and adjust the [arango] section cp configs/config.example.toml configs/config.toml # Run the full smoke suite for the new clients/ HTTP library ./bin/console.php arango:test:clients # Run the smoke suite for the high-level ArangoDB façade ./bin/console.php arango:test:facade
Both commands accept --step=N, --step=N1-N2, --step=all, --no-cleanup, --endpoint=…, --user=…, --password=…, --database=….
🛠️ Generate the documentation
We use phpDocumentor to generate documentation into the ./docs folder.
composer doc
🤝 Contributing
Contributions are welcome! See CONTRIBUTING.md for setup, coding conventions, the testing workflow and the pull-request process.
🧾 License
Licensed under the Mozilla Public License 2.0 (MPL‑2.0).
👤 About the author
- Author: Marc ALCARAZ (aka eKameleon)
- Email:
marc@ooop.fr - Website:
https://www.ooop.fr
🔗 Related packages
| Package | Description |
|---|---|
| oihana/php-auth | Casbin RBAC + JWT/OIDC authorization toolkit. |
| oihana/php-commands | Symfony Console kernel and reusable command traits. |
| oihana/php-core | Core helpers and utilities shared across the ecosystem. |
| oihana/php-enums | Typed constants and enums — no more magic strings. |
| oihana/php-exceptions | Framework exceptions with consistent semantics. |
| oihana/php-files | File system helpers (paths, readers, writers). |
| oihana/php-reflect | Reflection and object hydration utilities. |
| oihana/php-schema | Schema.org constants and vocabulary. |
| oihana/php-signals | Signal/slot dispatcher for decoupled events. |
| oihana/php-system | Framework helpers — controllers, models, request handling. |
统计信息
- 总下载量: 45
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MPL-2.0
- 更新时间: 2026-05-25
