PHP code example of teitge / jsonsql

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

    

teitge / jsonsql example snippets


> $db->from('produkte')->where('status', 'active')->get();
> $item = $db->first();
> while (!$db->eof()) {
>     echo $item['name'] . "\n";
>     $item = $db->next();
> }
> 



use JsonSQL\JsonSQL;

$db = new JsonSQL([
    'path' => __DIR__ . '/data',
    'table' => 'users',
]);

$users = $db->select(['id', 'name'])
            ->where('age', '>=', 18)
            ->orderBy('name')
            ->get();

src/
├── JsonSQL.php          // Hauptklasse
├── JS_Base.php          // Gemeinsame Methoden
├── JS_Select.php        // SELECT-Logik
├── JS_Insert.php        // INSERT-Logik
├── JS_System.php        // Automatische Felder, Validierung, Timestamps, ...
└── ...