File tree Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -61,31 +61,25 @@ composer require jsondbphp/jsondb
61
61
62
62
#### Example
63
63
64
- ``` php
64
+ - First create a folder ` data ` .
65
+ - Create a ` users.json ` file inside of data folder.
65
66
66
- // index.php
67
+ ``` php
68
+ <?php
67
69
68
- require("vendor/autoload.php"):
70
+ require("vendor/autoload.php");
69
71
70
- use Json\Database;
72
+ use Json\Database\JsonDB ;
71
73
72
74
// Create DB instance
73
75
$db = new JsonDB(__DIR__ . '/data');
74
76
75
77
// Insert
76
- $id = $db->collection ('users')->insert( [
78
+ $id = $db->insert ('users', [
77
79
'name' => 'Alice',
78
80
'email' => 'alice@example.com'
79
81
]);
80
82
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);
89
83
```
90
84
91
85
---
You can’t perform that action at this time.
0 commit comments