PHP code example of hrupin / yii2-file

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

    

hrupin / yii2-file example snippets


php composer.phar 

"hrupin/yii2-file": "*"

use hrupin\file\File;

$dir = '/some/your/dir';

$file = new File($dir, 'file.txt');
$file->readAllFile();
$file->readStrFile(10);
$file->closeFile();

$file->createFile($dir, 'anotherFile.txt');
$file->writeFile('You some text or data ...');
$file->writeFile('Add you some text or data ...');
$file->readAllFile();
$file->closeFile();

var_dump($file->getErrors());