PHP code example of georgechem / sqlite-db

1. Go to this page and download the library: Download georgechem/sqlite-db 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/ */

    

georgechem / sqlite-db example snippets


class User extends Db {
    self::$pdo - object is available 
    
    ... add your methods like: 
    public function insertUser() ... etc.
    
    Methods that must be implemented (

mixed $value - it can be any type (under the hood $value is serialized and
unserialized so type is preserved);

string $key - as it states must be a string



$storage = new Storage(); 

// save value associated with certain key in database (keys are unique)
$storage->save(string 'key_name', mixed $value);

// if you want to overwrite certain key set appropriate flag
$storage->save(string 'key_name', mixed $value, true);

// To read value associated wit certain key
$storage->read(string 'test');

// returns array of all available key in storage OR empty array if none
$storage->getAllKeys();

// empty storage (delete only entries but keep table)
$storage->empty();

// destroy storage
$storage->destroy();