Skip to content

Classes

Here we have listed all classes with their parameters and returned value and how to use them.

SHORTLY : Fast & Small document of all classes!

How to load and use classes?

All classes have their own namespace and each one is in the file named as their name. You can load classes with calling them on top of your codes.

Step By Step - Define Method

  1. We include jsondb file witch automatically load classes by their definition on codes!
    <?php
    //including composer autoload
    include 'vendor/autoload.php';
    
  2. We define class on top of codes. (For example : USER)
    <?php
    // In this case we use the original name of class.
    use JSONDB\request\user;
    // In other case you can set specific name for class usage in your code!
    use JSONDB\request\user as account;
    
  3. We call to class defined on top of code.
    <?php
    // Call class we defined with original name
    $user=new user($username,$password);
    // Call class we defined with specific name
    $user=new account($username,$password);
    
  4. Now we can call any function from class and use it.
    <?php
    var_dump($user->login());
    var_dump($user->get('lastLogin'));
    ...
    

Step By Step - Direct Method

  1. We include jsondb file witch automatically load classes by calling them on codes!
    <?php
    //including composer autoload
    include 'vendor/autoload.php';
    
  2. We call to class with full namespace.
    <?php
    // Call class directly with full namespace
    $user=new JSONDB\request\user($username,$password);
    
  3. Now we can call any function from class and use it.
    <?php
    var_dump($user->login());
    var_dump($user->get('lastLogin'));
    ...
    

List of Classes

Class Parameter Description
CONNECT $server_type , $address , $port , $timeout , $proxy
string , string , int , int , array
Create a connection from library to jsondb server/host by curl
USER $username , $password , $output
string , string , string/null
Send user section request to jsondb server/host by curl
DATABASE $output
string/null
Send database section request to jsondb server/host by curl
BASE $output
string/null
Send base section request to jsondb server/host by curl
DATACENTER $output
string/null
Send datacenter section request to jsondb server/host by curl

JSONDB\lib\connect

Info

This class is only for verify the server and create connection to server. Other classes don't work without accepting and connecting to server by this class!

Functions Parameters Description
------- ----------------- ------------------------------------------

JSONDB\request\user

Functions Parameters Description
rapid_login $save_session
boolean
Send a rapid login request to jsondb server/host.
login $save_session
boolean
Send a login request to jsondb server/host. In this method of login it takes a little more time to login
continue $session_id
string/null
Continue last login using last session id or entered session id
terminate ---------------------- Terminate current session id (if you use this function you must login again)
update $what , $set , $username
string/array , string/array , string/null
Update current or another user info
get $what
string/array
Get current user info
create $username , $password , $type , $active
string , string , string , boolean
Get current user info
delete $username
string
Delete a user

JSONDB\request\database

Functions Parameters Description
select $name
string
Select a database
build $name , $maxsize , $maxbase , $users , $comment , $encrypt , $select
string , integer , integer , array/null , string/null , boolean , boolean
Build a new database
modify $what , $set
string/array , string/array
Modify database setting
obtain $what
string/array
Obtain database setting
delete $what , $set , $username
string/array , string/array , string/null
Delete current selected database
clean $what
string/array
Clean current selected database
export $save_file , $path_to_save
boolean , string/null
Export current selected database
import $source
string
Import a database

JSONDB\request\base

Functions Parameters Description
select $name
string
Select a base
create $name , $maxrecord , $comment , $encrypt , $select
string , integer , string/null , boolean , boolean
Create a new base
modify $what , $set
string/array , string/array
Modify base setting
obtain $what
string/array
Obtain base setting
delete $what , $set , $username
string/array , string/array , string/null
Delete current selected base
clean $what
string/array
Clean current selected base
export $save_file , $path_to_save
boolean , string/null
Export current selected base
import $source
string
Import a base

JSONDB\request\datacenter

Functions Parameters Description
replace $object , $value , $where_object , $where_value , $limit
string/array , string/array , string/array/null , string/array/null , integer/null
Replace/add data to record(s)
receive $object , $where_object , $where_value , $limit
string/array , string/array/null , string/array/null , integer/null
Receive data from record(s)
add $object , $value
string/array , string/array
Add a record
delete $id , $where_object , $where_value , $limit
integer/array/string , string/array/null , string/array/null , integer/null
Delete record(s)
remove $object , $where_object , $where_value , $limit
string/array , string/array/null , string/array/null , integer/null
Remove data from record(s)