Skip to content

Getting Started

Getting started with JSONDB LV is so easy. Any methods have the same name like JSONDB server methods and accepts the same parameter like JSONDB server and returned the same server response with three types of response supported

We may that you have

  • installed this library before (Reference)
  • A ready to use JSONDB server with the following credentials installed :
    Address: jsondb.example.com
    Port: 443 (default https port)
    Username : root
    Password: admin1234

Start with basics

Create a connection to server

installed manually

if installed library manually, Replace line 3 with require __DIR__.'jsondb/jsondb.class.php';

<?php
//requiring composer autoload
require __DIR__.'/vendor/autoload.php';
//load class from reference
use JSONDB\lib\connect;

define('SERVER_TYPE','hv');
define('SERVER_ADDRESS','https://jsondb.example.com');
define('SERVER_PORT','443');
define('SERVER_USERNAME','root');
define('SERVER_PASSWORD','admin1234');

//create connection handler (It will be create connection to server automatically)
new  connect(SERVER_TYPE,SERVER_ADDRESS,SERVER_PORT);

Login to server

1
2
3
4
5
6
7
8
9
<?php
//load class from reference
use JSONDB\request\user;

//create user handler
$user=new user(SERVER_USERNAME,SERVER_PASSWORD);

//send a login request to server with credentials entered in user handler
$user->login();

build or select database

<?php
//load class from reference
use JSONDB\request\database;

//create database handler
$db=new database();

//building a database
$db->build($name,$maxsize,$maxbase);

//selecting a database builded before (you should have access to database)
$db->select($name);

build or select base

What is base?

It's a part of your database used for separate records like "table" in MYSQL

<?php
//load class from reference
use JSONDB\request\base;

//create base handler
$db=new base();

//building a base
$db->create($name,$maxrecord);

//selecting a base builded before (you should have access to base)
$db->select($name);

Records management (Add,Update,Get,...)

What is record?

All data you save in database will be save in records like "row" in MYSQL.

<?php
//load class from reference
use JSONDB\request\datacenter;

//create datacenter handler
$dc=new datacenter();

//adding a record to selected database and base
$dc->add($object,$value);

//receiving data stored in records
$dc->receive($object,$where_object,$where_value);

//replacing new data with last data stored in records
$dc->replace($object,$value,$where_object,$where_value);

Full Documentation

You can also use these references to see full documentation :

Classes Functions Requests Responses

If you want a specific method documents use search box on header!