1. Go to this page and download the library: Download flsouto/fstore 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/ */
flsouto / fstore example snippets
lSouto\Fstore;
use FlSouto\FstoreTable;
$db = new Fstore('/home/fabio/Documentos/fstore/tests'.'/test_db');
lSouto\Fstore;
use FlSouto\FstoreTable;
$db = new Fstore('/home/fabio/Documentos/fstore/tests'.'/test_db');
// creates users table on the fly
$products = $db->table('products');
lSouto\Fstore;
use FlSouto\FstoreTable;
$db = new Fstore('/home/fabio/Documentos/fstore/tests'.'/test_db');
$products = $db->table('products');
$id = $products->insert([
'name' => 'Pencil',
'description' => 'Can be used to write things down.',
'price' => 1.99
]);
$new_row = $products->get($id);
print_r($new_row);
lSouto\Fstore;
use FlSouto\FstoreTable;
$db = new Fstore('/home/fabio/Documentos/fstore/tests'.'/test_db');
$products = $db->table('products');
$id = $products->insert([
'name' => 'Pencil',
'description' => 'Can be used to write things down.',
'price' => 1.99
]);
$date = $products->date('d/m/Y H:i', $id);
echo $date;
lSouto\Fstore;
use FlSouto\FstoreTable;
$db = new Fstore('/home/fabio/Documentos/fstore/tests'.'/test_db');
$products = $db->table('products');
$id = $products->insert([
'name' => 'Pencil',
'description' => 'Can be used to write things down.',
'price' => 1.99
]);
$products->update(['price'=>1.5], $id);
$row = $products->get($id);
print_r($row);
lSouto\Fstore;
use FlSouto\FstoreTable;
$db = new Fstore('/home/fabio/Documentos/fstore/tests'.'/test_db');
$products = $db->table('products');
$id = $products->insert([
'name' => 'Pencil',
'description' => 'Can be used to write things down.',
'price' => 1.99
]);
$products->delete($id);
lSouto\Fstore;
use FlSouto\FstoreTable;
$db = new Fstore('/home/fabio/Documentos/fstore/tests'.'/test_db');
$table = $db->table('alphabet');
foreach(['a','b','c','d'] as $letter){
$table->insert([
'letter' => $letter
]);
}
$ids = $table->ids();
print_r($ids);
lSouto\Fstore;
use FlSouto\FstoreTable;
$db = new Fstore('/home/fabio/Documentos/fstore/tests'.'/test_db');
$table = $db->table('alphabet');
foreach(range('a','z') as $letter){
$table->insert([
'letter' => $letter
]);
}
$first_10_ids = $table->ids(10);
print_r($first_10_ids);
lSouto\Fstore;
use FlSouto\FstoreTable;
$db = new Fstore('/home/fabio/Documentos/fstore/tests'.'/test_db');
$table = $db->table('alphabet');
foreach(range('a','z') as $letter){
$table->insert([
'letter' => $letter
]);
}
$last_10_ids = $table->ids(-10);
print_r($last_10_ids);
lSouto\Fstore;
use FlSouto\FstoreTable;
$db = new Fstore('/home/fabio/Documentos/fstore/tests'.'/test_db');
$table = $db->table('alphabet');
foreach(range('a','z') as $letter){
$table->insert([
'letter' => $letter
]);
}
$q = $table->query();
// only rows that satisfy certain conditions
$q->filter(function($row){
return in_array($row['letter'], ['f','a','b','i','o']);
});
// fetch those rows
$rows = $q->rows();
print_r($rows);
lSouto\Fstore;
use FlSouto\FstoreTable;
$db = new Fstore('/home/fabio/Documentos/fstore/tests'.'/test_db');
$table = $db->table('alphabet');
foreach(range('a','z') as $letter){
$table->insert([
'letter' => $letter
]);
}
$q = $table->query();
// the last ten
$q->limit(-10);
// fetch them
$rows = $q->rows();
print_r($rows);
lSouto\Fstore;
use FlSouto\FstoreTable;
$db = new Fstore('/home/fabio/Documentos/fstore/tests'.'/test_db');
$table = $db->table('alphabet');
foreach(range('a','z') as $letter){
$table->insert([
'letter' => $letter
]);
}
$q = $table->query();
// first ten
$q->limit(10);
// fetch values of 'letter' column
$values = $q->values('letter');
print_r($values);
lSouto\Fstore;
use FlSouto\FstoreTable;
$db = new Fstore('/home/fabio/Documentos/fstore/tests'.'/test_db');
$table = $db->table('alphabet');
foreach(range('a','z') as $letter){
$table->insert([
'letter' => $letter
]);
}
$q = $table->query();
// only rows that satisfy certain conditions
$q->filter(function($row){
return in_array($row['letter'], ['f','a','b','i','o']);
});
// fetch only the ids
$ids = $q->ids();
print_r($ids);
lSouto\Fstore;
use FlSouto\FstoreTable;
$db = new Fstore('/home/fabio/Documentos/fstore/tests'.'/test_db');
$table = $db->table('users');
$table->insert([
'name'=>'Alucard',
'email'=>'[email protected]',
]);
$rows = $table->query()->selid('_id')->rows();
print_r($rows);
// Selects rows from 5 days ago up until now
$result = $table->query()->since('-5 days')->rows();
// Selects rows from the start up until 5 days ago
$result = $table->query()->until('-5 days')->rows();
// Selects rows from day -5 up until day -2
$result = $table->query()->since('-5 days')->until('-2 days')->rows();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.