laravel-freelancer-nl / fluentaql
PHP AQL Query Builder
Fund package maintenance!
Requires
- php: ^8.0
- ext-json: *
- spatie/ray: ^1.34
Requires (Dev)
- ergebnis/composer-normalize: ^2.6
- mockery/mockery: ^1.4
- nikic/php-parser: ^4.2@dev
- phpmd/phpmd: ^2.9
- phpstan/phpstan: ^1.2
- phpunit/phpunit: ^9.5
- scrutinizer/ocular: ^1.8
- squizlabs/php_codesniffer: ^3.5
- vimeo/psalm: ^4.10
- dev-next
- 2.1.1
- 2.1.0
- 2.0.0
- 1.4.0
- 1.3.0
- 1.2.0
- 1.1.0
- 1.0.0
- 1.0.0-beta.12
- 1.0.0-beta.11
- 1.0.0-beta.10
- 1.0.0-beta.9
- 1.0.0-beta.8
- 1.0.0-beta.7
- 1.0.0-beta.6
- 1.0.0-beta.5
- 1.0.0-beta.4
- 1.0.0-beta.3
- 1.0.0-beta.2
- 1.0.0-beta.1
- 1.0.0-beta
- 1.0.0-alpha
- 0.5
- 0.4
- 0.3
- 0.2
- 0.1
- dev-dependabot/github_actions/dependabot/fetch-metadata-2.5.0
- dev-dependabot/github_actions/actions/cache-5
- dev-dependabot/github_actions/actions/checkout-6
- dev-dependabot/github_actions/stefanzweifel/git-auto-commit-action-7
This package is auto-updated.
Last update: 2026-03-31 06:51:04 UTC
README
Fluent PHP query builder for ArangoDB’s Query Language (AQL).
I’m archiving my ArangoDB PHP/Laravel packages
Due to the license changes ArangoDB introduced last year, it no longer makes sense for me to continue using the product or to invest further time in developing, maintaining, and improving these packages.
While building and running side projects is in many ways easier and more affordable than ever, the new license creates a significant barrier for my own projects.
I’ve genuinely enjoyed working with ArangoDB, and I still believe it is an excellent product. However, under the current licensing model, I can no longer justify the time required to support these packages. Time is my most limited resource, and I need to allocate it where it makes sense professionally.
As a result, I am archiving the following packages:
- The Laravel driver: https://github.com/LaravelFreelancerNL/laravel-arangodb
- The PHP client: https://github.com/LaravelFreelancerNL/arangodb-php-client
- The AQL query builder: https://github.com/LaravelFreelancerNL/fluentaql
If there is interest in continuing their development, you are welcome to fork them and maintain your own versions. Alternatively, if you would like to sponsor or hire me to continue maintaining them, please feel free to get in touch.
Thank you to everyone who has used, supported, or contributed to these packages.
So long, and thanks for all the fish.
Bas
Laravel Freelancer NL
Table of contents
Purpose
Using a query builder mainly makes the life of a programmer much easier. You can write cleaner code and be quicker at it. Which of course comes at the cost of application speed.
If you need bleeding edge speed you will need to write your own queries.
The use of a query builder has both pros and cons. It is up to you to decide what you need.
Cons:
- Sacrificing speed
- You still need to understand ArangoDB, AQL and the 'schema' of your database.
- Slight variations between the query builder API and the raw AQL output which may be confusing
Pros
- Programmatically compose queries (e.g. search facets).
- Easy query decomposition
- Dry up your code.
- Reduce AQL syntax bugs
- Flexible expression input
- IDE intellisense.
Requirements
| FluentAQL | ArangoDB | PHP |
|---|---|---|
| 1.x | ^3.6 | ^8.0 |
- ArangoDB regularly adds AQL functions and clauses in minor versions. So be sure to check the AQL documentation for the availability of specific features.
Installation
You know the drill:
composer require laravel-freelancer-nl/fluentaql
Before you begin: safety first!
FluentAQL is a query builder that focuses on making your life as a developer easier while maintaining the strength and flexibility of AQL. It focuses on syntax checking of the provided expressions however that is not airtight if you don't bind user input.
Always bind user input.
Usage
First fire up a new query builder then fluently add AQL clauses on top.
Step 1: create a query builder:
use LaravelFreelancerNL\FluentAQL\QueryBuilder;
...
$qb = new QueryBuilder();
Step 2: compose your query:
For Example:
$qb->for('i', '1..100')->filter('i', '<', 50)->limit(10)->sort('i', 'desc')->return('i');
Step 3: compile the query
$qb->get();
The query builder now contains the query, binds and collections (*) for you to send to ArangoDB through a client.
$query = $qb->query;
$binds = $qb->binds;
$collections = $qb->collections;
- Collections must be passed to ArangoDB in order to prevent deadlocks in certain cluster operations and transactions.
The generated AQL for this query is:
FOR i IN 1..100 FILTER i < 50 LIMIT 10 SORT i DESC RETURN i
(Always) bind user input
No matter what, never trust user input and always bind it.
$qb->bind('your data')
Binds are registered in order and given an id. If you want to specify the bind name yourself you can add it:
$qb->bind('your data', 'your-bind-id')
Documentation
- API
- Query clauses: how to search, select, sort and limit data
- Statement clauses: data manipulation & variable declaration
- Graph clauses: graph traversals
- Functions: a list of all supported AQL functions
- Operator expressions: if() & calc() expressions
- Subqueries: how to create subqueries, joins etc.
- Core Concepts
- Terminology: definitions of terms used in the documentation
- Data binding: How to inject external data and collections
- Predicates: How to use predicates in filter clauses and functions
- Subqueries: Subquery creation
References & resources
ArangoDB
Related packages
Credits
- Pluma@arangodb