Skip to content

Commit 9bfc0fa

Browse files
committed
initial working of readme
1 parent 2949af5 commit 9bfc0fa

File tree

4 files changed

+232
-5
lines changed

4 files changed

+232
-5
lines changed

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+

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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
"scripts": {
5252
"cs": "vendor/bin/php-cs-fixer fix --dry-run --diff --allow-risky=yes",
5353
"cs:fix": "vendor/bin/php-cs-fixer fix --allow-risky=yes",
54-
"psalm": "vendor/bin/psalm --no-cache --show-info=true"
54+
"psalm": "vendor/bin/psalm --no-cache --show-info=true",
55+
"phpunit" : "vendor/bin/phpunit"
5556
}
5657

5758
}

phpunit.dist.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,9 @@
1313
<log type="testdox" target="php://stdout" />
1414
</logging>
1515
-->
16+
17+
<!-- <env name="NEO4J_ADDRESS" value="<put your address here>"/>-->
18+
<!-- <env name="NEO4J_USERNAME" value="<put your name here>"/>-->
19+
<!-- <env name="NEO4J_PASSWORD" value="<put your password here>"/>-->
1620
<!-- No need to set sensitive information here -->
1721
</phpunit>

0 commit comments

Comments
 (0)