1. Go to this page and download the library: Download survos/pixie-bundle 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/ */
survos / pixie-bundle example snippets
#[AsEventListener(event: RowEvent::class)]
public function onRowEvent(RowEvent $event): void
{
static $mun = []; // the array of municipios
$row = $event->row;
switch ($event->type) {
case $event::POST_LOAD:
ksort($mun);
// save this to a new table or JSON file
break;
case $event::LOAD:
// https://www.facebook.com/MuseoGuadalupePosada?fref=ts -> MuseoGuadalupePosada
if ($facebook = $row['facebook']??null) {
$parseUrl = parse_url($facebook);
$row['facebook'] = trim($parseUrl['path'],'/');
}
$mun[$row['municipio_id']] = $row['municipio'];
}
}
$pixie = new Pixie::Reader('school.pixie');
$pixie->select('mo')
foreach ($pixie->)
// inject the service
$id = 'tt123';
$kv = $pixieService->getStorageBox('dummy.pixie', [
'products' => 'sku,brand,category' // first key is text primary key by default
]);
$kv->select('products'); // so that we don't have to pass it each time.
$kv->set($data); // because they key is in the data.
assert($kv->get($id));
assert($kv->has($id));
assert(json_decode($kv->get($id)) == $data);
//
$kv = $pixieService->getStorageBox('app.db', [
'movies' => 'imdb_id, year|integer, category|string' // first key is text primary key by default
]);
$rows = $kv->where("year < 2000 and category='drama'")->iterate();
// without the index
$rows = $kv->where("json_extract(value, '$.year') < 2000")->iterate();