PHP code example of neoan3-apps / file-away

1. Go to this page and download the library: Download neoan3-apps/file-away 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/ */

    

neoan3-apps / file-away example snippets


$db = new \Neoan3\Apps\FileAway('storage.json');

// add entry to new or existing entity
$db->setEntity('articles') // set current entity
   ->add(['title'=>'demo post', 'content' => 'such text']) // add entry to entity
   ->save() // write to db

// list all entries (NOTE: we assume that the entity is still set)
foreach($db->find() as $post) {
    echo $post->title . "<br>";
}

// find one
echo $db->findOne(['title' => 'demo post'])->content;