Skip to content

Commit d74b31f

Browse files
Docs update
1 parent 792112e commit d74b31f

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

README.md

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,31 +61,25 @@ composer require jsondbphp/jsondb
6161

6262
#### Example
6363

64-
```php
64+
- First create a folder `data`.
65+
- Create a `users.json` file inside of data folder.
6566

66-
// index.php
67+
```php
68+
<?php
6769

68-
require("vendor/autoload.php"):
70+
require("vendor/autoload.php");
6971

70-
use Json\Database;
72+
use Json\Database\JsonDB;
7173

7274
// Create DB instance
7375
$db = new JsonDB(__DIR__ . '/data');
7476

7577
// Insert
76-
$id = $db->collection('users')->insert([
78+
$id = $db->insert('users', [
7779
'name' => 'Alice',
7880
'email' => 'alice@example.com'
7981
]);
8082

81-
// Find
82-
$user = $db->collection('users')->find($id);
83-
84-
// Update
85-
$db->collection('users')->update($id, ['email' => 'new@example.com']);
86-
87-
// Delete
88-
$db->collection('users')->delete($id);
8983
```
9084

9185
---

0 commit comments

Comments
 (0)