Skip to content

Commit 92411be

Browse files
committed
Merge remote-tracking branch 'origin/main'
# Conflicts: # .gitignore
2 parents edcd4b1 + 4cf08dd commit 92411be

37 files changed

+1220
-8011
lines changed

.github/workflows/cs-fixer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Set up PHP
1717
uses: shivammathur/setup-php@v2
1818
with:
19-
php-version: 8.2
19+
php-version: 8.1
2020
tools: composer
2121

2222
- name: Install dependencies

.github/workflows/psalm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Set up PHP
1818
uses: shivammathur/setup-php@v2
1919
with:
20-
php-version: 8.3
20+
php-version: 8.1
2121
tools: composer, psalm
2222

2323
- name: Install dependencies

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Set up PHP
3434
uses: shivammathur/setup-php@v2
3535
with:
36-
php-version: 8.2
36+
php-version: 8.1
3737
tools: composer, xdebug
3838

3939
- name: Cache Composer dependencies

.github/workflows/testaura.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Set up PHP
2424
uses: shivammathur/setup-php@v2
2525
with:
26-
php-version: 8.2
26+
php-version: 8.1
2727
tools: composer, xdebug
2828

2929
- name: Cache Composer dependencies

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ test
1515
.php-cs-fixer.cache
1616

1717

18-
coverage
18+
coverage
19+
20+
composer.lock

Contributing.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Contributing to Neo4j QueryAPI he PHP Client
2+
3+
Thank you for your interest in contributing to the Neo4j QueryAPI PHP Client! We welcome all contributions, whether it's bug fixes, feature enhancements, or documentation improvements.
4+
5+
## Getting Started
6+
7+
1. **Fork the Repository**\
8+
Click the "Fork" button at the top right of the repository page.
9+
10+
2. **Clone Your Fork**
11+
12+
```bash
13+
git clone https://github.com/your-username/Neo4j-Client.git
14+
cd Neo4j-Client
15+
```
16+
17+
3. **Set Up the Environment**
18+
19+
- Ensure you have PHP installed (compatible with PHP < 7.1).
20+
- Install dependencies using Composer:
21+
22+
```bash
23+
composer install
24+
```
25+
26+
- Copy the `phpunit.dist.xml` file to `phpunit.xml` and configure the necessary environment variables like `NEO4J_ADDRESS`, `NEO4J_USERNAME`, `NEO4J_PASSWORD`.
27+
28+
29+
30+
4. **Run Tests**\
31+
Our tests use PHPUnit. To run tests:
32+
33+
```bash
34+
composer/phpunit
35+
```
36+
37+
## Code Guidelines
38+
39+
- Ensure your code is **PSR-12 compliant**.
40+
- Use **Psalm** for static analysis. Run:
41+
```bash
42+
composer psalm
43+
```
44+
- Apply **code style fixes** using:
45+
```bash
46+
composer cs:fix
47+
```
48+
49+
## Making Changes
50+
51+
1. **Create a New Branch**\
52+
Use a descriptive branch name:
53+
54+
```bash
55+
git checkout -b fix/issue-123
56+
```
57+
58+
2. **Make Your Edits**\
59+
Ensure all tests pass and code is properly formatted.
60+
61+
3. **Commit Your Changes**\
62+
Write clear commit messages:
63+
64+
```bash
65+
git commit -m "Fix: Corrected query parsing for ProfiledQueryPlan"
66+
```
67+
68+
4. **Push Your Branch**
69+
70+
```bash
71+
git push origin fix/issue-123
72+
```
73+
74+
## Submitting a Pull Request
75+
76+
1. Go to your forked repository on GitHub.
77+
2. Click on the "New pull request" button.
78+
3. Select your branch and submit the pull request.
79+
4. Add a clear description of the changes you made.
80+
81+
## Review Process
82+
83+
- All PRs are reviewed by the maintainers.
84+
- Ensure CI tests pass before requesting a review.
85+
- Be open to feedback and make revisions as needed.
86+
87+
## Reporting Issues
88+
89+
If you spot a bug or want to suggest a new feature, please [open an issue](https://github.com/NagelsIT/Neo4j-Client/issues) and provide detailed information.
90+
91+
---
92+
93+
We appreciate your contribution — let’s build something powerful together!
94+

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Nagels IT
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 132 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,138 @@
1+
Neo4jQueryAPI client
2+
3+
The Neo4j QueryAPI client is for developers and data engineers who want to interact programmatically with Neo4j databases — running queries, handling results, and managing database configurations. It offers:
4+
5+
- Easy configuration to pick and choose drivers
6+
- An intuitive API for smooth query execution
7+
- Extensibility for custom use cases
8+
- Built and tested under close collaboration with the official Neo4j driver team
9+
- Easier to start with, just need a client to any neo4j instance
10+
- Fully typed with Psalm and CS fixed for code quality
11+
- It does not supports Bolt, Rather compatible with HTTP, and auto-routed drivers
12+
13+
14+
115
# Query API
216

3-
Usage example:
17+
A PHP client for Neo4j, a graph database.
18+
19+
## Installation
20+
21+
You can install the package via Composer:
22+
23+
```sh
24+
composer require this-repo/neo4j-client
25+
```
26+
27+
## Usage
28+
29+
### Connecting to Neo4j
430

531
```php
632
use Neo4j\QueryAPI\Neo4jQueryAPI;
7-
use Neo4j\QueryAPI\Objects\Authentication;
33+
use Neo4j\QueryAPI\Authentication\AuthenticateInterface;
34+
35+
$client = Neo4jQueryAPI::login('http://localhost:7474', new AuthenticateInterface('username', 'password'));
36+
```
37+
38+
### Running a Query
39+
40+
```php
41+
$query = 'MATCH (n) RETURN n';
42+
$result = $client->run($query);
43+
44+
foreach ($result as $record) {
45+
print_r($record);
46+
}
47+
```
48+
49+
### Transactions
50+
51+
#### Begin a Transaction
52+
53+
```php
54+
$transaction = $client->beginTransaction();
55+
```
56+
57+
#### Run a Query in a Transaction
58+
59+
```php
60+
$query = 'CREATE (n:Person {name: $name}) RETURN n';
61+
$parameters = ['name' => 'John Doe'];
62+
$result = $transaction->run($query, $parameters);
63+
```
64+
65+
#### Commit a Transaction
66+
67+
```php
68+
$transaction->commit();
69+
```
70+
71+
#### Rollback a Transaction
72+
73+
```php
74+
$transaction->rollback();
75+
```
76+
77+
## Testing
78+
79+
To run the tests, execute the following command:
80+
81+
```sh
82+
vendor/bin/phpunit
83+
```
84+
85+
Cypher values and types map to these php types and classes:
86+
87+
| Cypher | PHP |
88+
|--------------------|:-----------------:|
89+
| Single name | |
90+
| Integer | ``` * int ``` |
91+
| Float | ``` * float ``` |
92+
| Boolean | ``` * bool ``` |
93+
| Null | ``` * null ``` |
94+
| String | ``` * string ``` |
95+
| Array | |
96+
| Date | |
97+
| Duration | |
98+
| 2D Point | |
99+
| 3D Point | |
100+
| Cartesian 2D Point | |
101+
| Cartesian 3D Point | |
102+
| Node | |
103+
| Path | |
104+
| Map | |
105+
| Exact name | |
106+
| Bookmarks | Yes |
107+
108+
## Diving deeper:
109+
110+
| Feature | Supported? |
111+
|----------|:-------------:|
112+
| Authentication | Yes |
113+
| Transaction | Yes |
114+
| HTTP | Yes |
115+
| Cluster | Yes |
116+
| Aura | Partly (recent versions) |
117+
| Bookmarks | Yes |
118+
119+
> **_NOTE:_** It supports neo4j databases versions > 5.25 (which has QueryAPI enabled.)
120+
121+
122+
123+
## Contributing
124+
125+
Please see CONTRIBUTING for details.
126+
127+
## Security
128+
129+
If you discover any security-related issues, please email *[email protected]* instead of using the issue tracker.
130+
131+
## Credits
132+
133+
- [Your Name](https://github.com/your-github-username)
134+
- [All Contributors](https://github.com/your-repo/neo4j-client/graphs/contributors)
135+
136+
## License
8137

9-
$client = Neo4jQueryAPI::login('https://myaddress.com', Authentication::bearer('mytokken'))
10-
```
138+
The MIT License (MIT). Please see License File for more information.

composer.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@
33
"name": "neo4j-php/query-api",
44
"description": "Easy to use class to run Cypher queries on the Query API",
55
"require": {
6-
"guzzlehttp/guzzle": "^7.9",
76
"psr/http-client": "^1.0",
87
"ext-json": "*",
98
"php": "^8.1",
10-
"nyholm/psr7": "^1.8"
9+
"nyholm/psr7": "^1.8",
10+
"php-http/discovery": "^1.17"
1111
},
1212
"require-dev": {
13+
"guzzlehttp/guzzle": "^7.9",
1314
"phpunit/phpunit": "^10.0",
1415
"friendsofphp/php-cs-fixer": "^3.68",
1516
"vimeo/psalm": "^6.8",
1617
"dg/bypass-finals": "^1.9",
1718
"psalm/plugin-phpunit": "^0.19.2"
18-
1919
},
20+
2021
"autoload": {
2122
"psr-4": {
2223
"Neo4j\\QueryAPI\\": "src/"
@@ -50,7 +51,8 @@
5051
"scripts": {
5152
"cs": "vendor/bin/php-cs-fixer fix --dry-run --diff --allow-risky=yes",
5253
"cs:fix": "vendor/bin/php-cs-fixer fix --allow-risky=yes",
53-
"psalm": "vendor/bin/psalm --no-cache --show-info=true"
54+
"psalm": "vendor/bin/psalm --no-cache --show-info=true",
55+
"phpunit" : "vendor/bin/phpunit"
5456
}
5557

5658
}

0 commit comments

Comments
 (0)