PHP code example of folded / file

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

    

folded / file example snippets


use function Folded\openFile;

$file = openFile("path/to/file.txt", "r");

use function Folded\openFile;
use function Folded\closeFile;

$file = openFile("path/to/file.txt", "r");

closeFile($file);

use function Folded\deleteFile;

deleteFile("path/to/file.txt");

use function Folded\openFile;
use function Folded\addCsvRowToFile;

$file = openFile("path/to/file.csv", "w");

addCsvRowToFile($file, ["foo", "bar"]);

use function Folded\openFile;
use function Folded\getCsvRowFromFile;

$file = openFile("path/to/file.csv", "r");

$firstRow = getCsvRowFromFile($file);
$secondRow = getCsvRowFromFile($file);

use function Folded\changeName;

changeName("path/to/old.txt", "path/to/new.txt");

use function Folded\writeOnFile;

$file = fopen("path/to/file.txt");

writeToFile($file, "some text");

use function Folded\writeOnFile;

$file = fopen("path/to/file.txt");

$numberOfBytesWritten = writeToFile($file, "some text");

echo "$numberOfBytesWritten bytes written";
bash
composer