Skip to content

Commit fa3bf3c

Browse files
committed
setup some more code examples
1 parent 0be267b commit fa3bf3c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,30 @@ A **client** manages **drivers** and routes the queries to the correct drivers b
375375

376376
The **driver** object is the thread-safe backbone that gives access to Neo4j. It owns a connection pool and can spawn **sessions** for carrying out work.
377377

378+
```php
379+
use Laudis\Neo4j\Basic\Driver;
380+
use Laudis\Neo4j\Databags\DriverConfiguration;
381+
382+
$driver = Driver::create(
383+
uri: 'neo4j://user:mypassword@Localhost:7687',
384+
configuration: DriverConfiguration::create()->withUserAgent('MyApp/1.0.0')
385+
);
386+
```
387+
378388
### Session
379389

380390
**Sessions** are lightweight containers for causally chained sequences of **transactions**. They borrow **connections** from the connection pool as required and chain transactions using **bookmarks**.
381391

392+
```php
393+
use Laudis\Neo4j\Databags\SessionConfiguration;
394+
use Laudis\Neo4j\Enum\AccessMode;
395+
396+
$session = $driver->createSession(SessionConfiguration::create()
397+
->withDatabase('my-database')
398+
->withAccessMode(AccessMode::READ())
399+
);
400+
```
401+
382402
### Transaction
383403

384404
**Transactions** are atomic units of work that may contain one or more **query**. Each transaction is bound to a single **connection** and is represented in the causal chain by a **bookmark**.

0 commit comments

Comments
 (0)