Skip to content

Commit b0c54cb

Browse files
Change bolt repo url and update to follow latest version (#1168)
* Change bolt repo url and update to follow latest version * Update php.mdx --------- Co-authored-by: Katarina Supe <[email protected]>
1 parent b9abce1 commit b0c54cb

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

pages/client-libraries/php.mdx

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import CodeSnippet from '/components/code-snippet/CodeSnippet'
1111

1212
Learn how to create a PHP application that connects to the Memgraph database and executes simple queries.
1313

14-
Community-contributed library [PHP Bolt](https://github.com/neo4j-php/Bolt) by Michal Štefaňák is the most commonly used to connect to Memgraph with PHP via Bolt protocol.
14+
Community-contributed library [PHP Bolt driver](https://github.com/stefanak-michal/php-bolt-driver) by Michal Štefaňák is the most commonly used to connect to Memgraph with PHP via Bolt protocol.
1515
Memgraph and Neo4j both support Bolt protocol and Cypher queries, which means that same client can be used to connect to both databases.
1616
This is very convenient if switching between the two databases is needed.
1717

@@ -21,7 +21,7 @@ The following guide will demonstrate how to start Memgraph, connect to it, seed
2121

2222
The necessary prerequisites that should be installed in your local environment are:
2323

24-
- [PHP >= 7.4](https://www.php.net/manual/en/install.php)
24+
- [PHP >= 8.1](https://www.php.net/manual/en/install.php)
2525
- [Composer](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-macos), a tool for dependency management in PHP.
2626
- [Docker](https://docs.docker.com/get-docker/)
2727

@@ -90,8 +90,8 @@ $bolt->setProtocolVersions(5.2);
9090
// Build and get protocol version instance which creates connection and executes handshake.
9191
$protocol = $bolt->build();
9292
// Login to database with credentials.
93-
$protocol->hello();
94-
$protocol->logon(\Bolt\helpers\Auth::basic('', ''));
93+
$protocol->hello()->getResponse();
94+
$protocol->logon(['scheme' => 'none', 'principal' => '', 'credentials' => ''])->getResponse();
9595

9696
// Pipeline two messages. One to execute query with parameters and second to pull records.
9797
$protocol
@@ -101,7 +101,7 @@ $protocol
101101
// Server responses are waiting to be fetched through iterator.
102102
$rows = iterator_to_array($protocol->getResponses(), false);
103103
// Get content from requested record.
104-
$row = $rows[1]->getContent();
104+
$row = $rows[1]->content;
105105

106106
echo 'Node ' . $row[0] . ' says: ' . $row[1];
107107
?>
@@ -113,7 +113,7 @@ In the example above Bolt protocol version 5.2 is used. When you're connecting t
113113
```php
114114
$bolt = new \Bolt\Bolt($conn);
115115
$bolt->setProtocolVersions(4.3, 4.1, 4.2);
116-
$protocol->hello(\Bolt\helpers\Auth::basic('', ''));
116+
$protocol->hello(['scheme' => 'none', 'principal' => '', 'credentials' => '']);
117117
```
118118
</Callout>
119119

@@ -128,10 +128,6 @@ composer require stefanak-michal/bolt
128128

129129
That command will create `composer.json` file.
130130

131-
<Callout type="info">
132-
To use Bolt protocol version 5.2 with Memgraph, install PHP Bolt library version >= 6.1.3.
133-
</Callout>
134-
135131
### Run the application
136132

137133
To run the application, run the following command in terminal:
@@ -152,7 +148,7 @@ Another way of running your application is by adding a script in the `composer.j
152148
```json
153149
{
154150
"require": {
155-
"stefanak-michal/bolt": "6.1.3"
151+
"stefanak-michal/bolt": "^7"
156152
},
157153
"scripts": {
158154
"start": "php -S localhost:4000"
@@ -177,7 +173,7 @@ That query will visualize the created node. By clicking on a node, you can explo
177173

178174
### Next steps
179175

180-
This guide makes a good starting point when building PHP applications. Check out the [PHP Bolt driver repository](https://github.com/neo4j-php/Bolt) to learn more about using the PHP Bolt library.
176+
This guide makes a good starting point when building PHP applications. Check out the [PHP Bolt driver repository](https://github.com/stefanak-michal/php-bolt-driver) to learn more about using the PHP Bolt library.
181177

182178
You can simplify the usage of this library with the [Memgraph Bolt wrapper](https://github.com/stefanak-michal/memgraph-bolt-wrapper).
183179

@@ -189,4 +185,4 @@ If you encounter serialization errors while using PHP client, we recommend
189185
referring to our [Serialization errors](/help-center/errors/serialization) page
190186
for detailed guidance on troubleshooting and best practices.
191187

192-
</Callout>
188+
</Callout>

0 commit comments

Comments
 (0)