PHPackages                             neo4j-php/query-api - 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. neo4j-php/query-api

ActiveLibrary[Database &amp; ORM](/categories/database)

neo4j-php/query-api
===================

Easy to use class to run Cypher queries on the Query API

1.0.0(1y ago)05[1 issues](https://github.com/nagels-tech/neo4j-query-api/issues)[2 PRs](https://github.com/nagels-tech/neo4j-query-api/pulls)PHPPHP ^8.1CI passing

Since Mar 3Pushed 1y ago1 watchersCompare

[ Source](https://github.com/nagels-tech/neo4j-query-api)[ Packagist](https://packagist.org/packages/neo4j-php/query-api)[ RSS](/packages/neo4j-php-query-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (9)Versions (4)Used By (0)

Neo4j Query API client
======================

[](#neo4j-query-api-client)

[![License](https://camo.githubusercontent.com/27006ec643585eb0ade641146023b3af39d003f36a6ea6eeb0d993febef1a173/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6e6167656c732d746563682f6e656f346a2d71756572792d617069)](https://camo.githubusercontent.com/27006ec643585eb0ade641146023b3af39d003f36a6ea6eeb0d993febef1a173/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6e6167656c732d746563682f6e656f346a2d71756572792d617069)[![Version](https://camo.githubusercontent.com/81204753667ebca119fc02dd30daf5c08721acf890a3f34c0aeeb1d08b2e31c3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6e6167656c732d746563682f6e656f346a2d71756572792d617069)](https://camo.githubusercontent.com/81204753667ebca119fc02dd30daf5c08721acf890a3f34c0aeeb1d08b2e31c3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6e6167656c732d746563682f6e656f346a2d71756572792d617069)[![Codacy Badge](https://camo.githubusercontent.com/9b6ce12c2592d41b996485812e324b00240fcbcce29828c9342585454fc460e3/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3263623861316537316564303439383762316337363361303965313936633834)](https://app.codacy.com/gh/nagels-tech/neo4j-query-api/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)[![codecov](https://camo.githubusercontent.com/81dbefdaa51ee39ae95af7fdf8f79b8769ba7d515d1cc18725099f65e6d98a14/68747470733a2f2f636f6465636f762e696f2f6769746875622f6e6167656c732d746563682f6e656f346a2d71756572792d6170692f67726170682f62616467652e7376673f746f6b656e3d4e544843465933384437)](https://codecov.io/github/nagels-tech/neo4j-query-api)[![Packagist Downloads](https://camo.githubusercontent.com/a70d94e93ae39ab32d86fe30507ed360d76cce8e9b1ff1341873b4ceeaef9107/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e656f346a2d7068702f71756572792d617069)](https://camo.githubusercontent.com/a70d94e93ae39ab32d86fe30507ed360d76cce8e9b1ff1341873b4ceeaef9107/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e656f346a2d7068702f71756572792d617069)

Interact programmatically with Top Graph Technology
---------------------------------------------------

[](#interact-programmatically-with-top-graph-technology)

- Easy to start with, just build your client in one line and start running queries
- Use an intuitive API for smooth query execution
- Built and tested under close collaboration with the official Neo4j driver team
- Fully typed with Psalm and CS fixed for code quality
- Uses HTTP under the hood instead of bolt
- Small, lightweight, well maintained and fully tested codebase

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

[](#installation)

You can install the package via Composer:

```
composer require neo4j-php/query-api
```

Client Installation
-------------------

[](#client-installation)

This client uses the HTTP protocol, make sure you have psr-7, psr-17, and psr-18 implementations included in your project. If you don't have any, you can install one of the many options via Composer:

```
composer require guzzlehttp/guzzle
```

> ***NOTE:*** PSR-17 and PSR-18 are essential for HTTP client communication. Other compatible clients like Guzzle can also be used. \* [PSR auto-discovery](https://docs.php-http.org/en/latest/discovery.html) will detect the installed HTTP client automatically.

Usage
-----

[](#usage)

### Connecting to Neo4j

[](#connecting-to-neo4j)

```
use Neo4j\QueryAPI\Neo4jQueryAPI;
use Neo4j\QueryAPI\Objects\Authentication;

$client = Neo4jQueryAPI::login('http://localhost:7474', Authentication::basic('username', 'password'));
```

### Running a Query

[](#running-a-query)

```
$query = 'MATCH (n) RETURN n';
$result = $client->run($query);

foreach ($result as $record) {
    print_r($record);
}
```

### Transactions

[](#transactions)

#### Begin a Transaction

[](#begin-a-transaction)

```
$transaction = $client->beginTransaction();
```

#### Run a Query in a Transaction

[](#run-a-query-in-a-transaction)

```
$query = 'CREATE (n:Person {name: $name}) RETURN n';
$parameters = ['name' => 'John Doe'];
$result = $transaction->run($query, $parameters);
```

#### Commit a Transaction

[](#commit-a-transaction)

```
$transaction->commit();
```

#### Rollback a Transaction

[](#rollback-a-transaction)

```
$transaction->rollback();
```

Testing
-------

[](#testing)

To run the tests, execute the following command:

```
vendor/bin/phpunit
```

Cypher values and types map to these php types and classes:

CypherPHPList`* array`Integer`* int`Float`* float`Boolean`* bool`Null`* null`String`* string `Array`* array`Local DateTime`* string ` (will be upgraded in version 1.1)Local Time`* string ` (will be upgraded in version 1.1)Zoned DateTime`* string ` (will be upgraded in version 1.1)Zoned Time`* string ` (will be upgraded in version 1.1)Duration`* string ` (will be upgraded in version 1.1)WGS 84 2D Point`Neo4j\QueryAPI\Objects\Point`WGS 84 3D Point`Neo4j\QueryAPI\Objects\Point`Cartesian 2D Point`Neo4j\QueryAPI\Objects\Point`Cartesian 3D Point`Neo4j\QueryAPI\Objects\Point`Map`* array `Node`Neo4j\QueryAPI\Objects\Node `Relationship`Neo4j\QueryAPI\Objects\Relationship  `Path`Neo4j\QueryAPI\Objects\Relationship`Diving deeper:
--------------

[](#diving-deeper)

FeatureSupported?AuthenticationYesTransactionYesHTTPYesClusterPartly \*AuraYesBookmarksYesBoltNo> \* Client side routing is only supported in the Neo4j driver

***NOTE:*** **It supports neo4j databases versions &gt; 5.25 or Neo4j Aura (which has QueryAPI enabled.)**

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](./Contributing.md) for details.

Security
--------

[](#security)

If you discover any security-related issues, please email ** instead of using the issue tracker.

Credits
-------

[](#credits)

- Created with ❤️ by Nagels
- [Kiran Chandani](https://www.linkedin.com/in/kiran-chandani-5628a1213/),
- [Pratiksha Zalte](https://github.com/p123-stack),
- [Ghlen Nagels](https://www.linkedin.com/in/ghlen/)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance46

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70.1% 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

Unknown

Total

1

Last Release

442d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9cb8ab20866bd4fb9928742bc2321fcfe89d5e8560d4abfdd52ba139072b487b?d=identicon)[transitive](/maintainers/transitive)

---

Top Contributors

[![p123-stack](https://avatars.githubusercontent.com/u/183799192?v=4)](https://github.com/p123-stack "p123-stack (101 commits)")[![123kiran17](https://avatars.githubusercontent.com/u/76966686?v=4)](https://github.com/123kiran17 "123kiran17 (27 commits)")[![transistive](https://avatars.githubusercontent.com/u/16435930?v=4)](https://github.com/transistive "transistive (15 commits)")[![pratikshazalte69](https://avatars.githubusercontent.com/u/123250052?v=4)](https://github.com/pratikshazalte69 "pratikshazalte69 (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/neo4j-php-query-api/health.svg)

```
[![Health](https://phpackages.com/badges/neo4j-php-query-api/health.svg)](https://phpackages.com/packages/neo4j-php-query-api)
```

###  Alternatives

[kreait/firebase-php

Firebase Admin SDK

2.4k39.7M72](/packages/kreait-firebase-php)[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k22.6M232](/packages/openai-php-client)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[mailgun/mailgun-php

The Mailgun SDK provides methods for all API functions.

1.1k28.9M168](/packages/mailgun-mailgun-php)[gotenberg/gotenberg-php

A PHP client for interacting with Gotenberg, a developer-friendly API for converting numerous document formats into PDF files, and more!

3685.2M19](/packages/gotenberg-gotenberg-php)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)

PHPackages © 2026

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