PHP code example of wallrio / deskdb

1. Go to this page and download the library: Download wallrio/deskdb library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wallrio / deskdb example snippets


use deskdb\Collection as Collection;

$deskdb = new Collection(COLLECTION_NAME,DRIVER);

use deskdb\drivers\JSON as JSON;
use deskdb\Collection as Collection;

$collection = new Collection('users',new JSON(__DIR__.'/mybase/'));


use deskdb\Document as Document;

$user = new Document();
$user->name = "Fulano da Silva";
$user->username = "fulano";
$user->password = md5("fulano");

$collection->post($user);

$result = $collection->get();

$result = $collection->get(KEY,VALUE,OPERATOR);

$result = $collection->getFirst(KEY,VALUE,OPERATOR);

$result = $collection->get();

$collection->delete($result);


$result = $collection->getFirst();

$result->name="ANOTHER NAME";
$result->age="34";

$collection->put($result);