1. Go to this page and download the library: Download adinan-cenci/json-lines 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/ */
adinan-cenci / json-lines example snippets
use AdinanCenci\JsonLines\JsonLines;
$associative = true;
$file = new JsonLines('my-file.jsonl', $associative);
foreach ($file->objects as $line => $object) {
echo $object->myProperty . '<br>';
// or $object['myProperty'] if ::$associative is true.
}
$search->condition('title', null, 'IS NULL');
// Will match entries where the "title" property equals null or is
// not defined.
$search->condition('title', 'Iliad', '=');
// Will match entries where the "title" property equals "Iliad"
// ( case insensitive ).
$search->condition('title', ['Iliad', ' Odyssey'], 'IN');
// Will match entries where the "title" property equals to either
// "Iliad" or "Odyssey" ( case insensitive ).
$search->condition('title', 'foo', 'LIKE');
// Will match entries where the "title" property contains the word "foo"
// e.g: "foo", "foo bar", "foofighters" etc ( case insensitive ).
$search->condition('title', ['foo', 'bar'], 'LIKE');
// It also accept arrays. This will match match
// "fool", "barrier", "barista" etc.
$search->condition('rating', '#\d stars?#', 'REGEX');
// Will match entries where the "rating" property matching "#\d stars?#"
// e.g: "1 star", "2 star", "3 stars" etc ( case insensitive ).
$search
->condition('title', 'Iliad', '!=') // Different to ( case insensitive ).
->condition('title', ['Iliad', ' Odyssey'], 'NOT IN') // case insensitive.
->condition('price', [10, 50], 'NOT BETWEEN')
->condition('title', ['foo', 'bar'], 'UNLIKE');
$search = $file->search();
$search
->condition('band', 'Iron Maiden', '=')
->condition('release', 2000, '<');
$results = $search->find();
// Will match entries for Iron Maiden from before the yar 2000.
$search = $file->search('OR');
$search
->condition('band', 'Blind Guardian', '=')
->condition('band', 'Demons & Wizards', '=');
$results = $search->find();
// Will match entries for both Blind Guardian and Demons & Wizards.
$search = $file->search('OR');
$search->andConditionGroup()
->condition('band', 'Angra', '=')
->condition('release', 2010, '<');
$search->andConditionGroup()
->condition('band', 'Almah', '=')
->condition('release', 2013, '>');
$results = $search->find();
// Will match entries for Angra from before 2010 OR
// entries for Almah from after 2013
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.