PHP code example of alsalty / jsonfile
1. Go to this page and download the library: Download alsalty/jsonfile 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/ */
alsalty / jsonfile example snippets
lsalty\Jsonfile\File;
use Alsalty\Jsonfile\Convert;
$data = ['name' => 'mohamad'];
// convert array to json
$data = Convert::convertToJson($data);
//initiate
$file = new File('data', 'test.json');
//create the file
$file->create($data);
//read the file
echo($file->read());
//delete the file
$file->delete();