yiisoft/files

dev-master / 3.0.x-dev 2019-09-06 11:24 UTC

README

993323

Yii files


The package provides useful methods to manage files and directories.

Latest Stable Version Total Downloads Build Status Scrutinizer Code Quality Code Coverage

General usage

Create a new directory:

use \Yiisoft\Files\FileHelper;

$directory = '/path/to/dir';
FileHelper::createDirectory($directory);

Create a new directory with the permission to be set:

use \Yiisoft\Files\FileHelper;

$directory = '/path/to/dir';
FileHelper::createDirectory($directory, 0775);

Remove a directory:

use \Yiisoft\Files\FileHelper;

$directory = '/path/to/dir';
FileHelper::removeDirectory($directory);

Remove a file or symlink:

use \Yiisoft\Files\FileHelper;

$file = '/path/to/file.txt';
FileHelper::unlink($file);

Normalize path:

use \Yiisoft\Files\FileHelper;

$path = '/home/samdark/./test/..///dev\yii/';
echo FileHelper::normalizePath($path);
// outputs:
// /home/samdark/dev/yii