Provide a wrapper to work on collections of data instead of dealing with arrays directly by hand. Sane and consistent function naming, without having to guess the order of arguments for callable arugments. Also implements common SPL interfaces so the Datastore can be passed onto other things that accept generic iterables.
See docs/API.md for full API documentation.
$Config = new Datastore([
'APIKEY' => 'qwer-ty-asdf-gh-zxcv-bn',
'Theme' => 'dark'
]);echo SomeCaptchaWidgetProbably(
$Config['APIKEY'],
$Config['Theme']
);(new Datastore($Users))
->Filter(fn(User $Who)=> $Who->HasOptedIn('emails'))
->SortByValue(fn(User $A, User $B)=> $A->Username <=> $B->Username)
->Remap(fn(User $Who)=> sprintf('%s <%s>', $Who->Username, $Who->Email))
->Reindex()
->Write('mailing-list.json');$Emails = Datastore::FromFile('mailing-list.json');
$Emails->Each(fn(string $To)=> print('* %s%s', $To, PHP_EOL));