futape/filesystem-utility
Composer 安装命令:
composer require futape/filesystem-utility
包简介
A library of filesystem utilities
README 文档
README
This library offers a set of utilities for working with the filesystem.
Utility functions are implemented as static functions in abstract classes, which are never expected to be instantiated.
Moreover this library offers a FilteredDirectoryIterator (see below).
Most functions accept path arguments, that are supported by Paths::normalize() and pass them through.
The results of most functions are also processed by that function.
Install
composer require futape/filesystem-utility
Usage
Paths
This utility class offers functions for working with paths.
Whenever possible the this utility is completely independent of the real underlying filesystem.
use Futape\Utility\Filesyste\Paths; echo Paths::strip('/foo/bar/baz', '/foo'); // "./bar/baz"
Files
A utility class for working with the filesystem.
use Futape\Utility\Filesyste\Files; touch('./foo'); var_dump(Files::remove('./foo')); // true
FilteredDirectoryIterator
An iterator that iterates over the contents of a directory, that match specified criteria.
use Futape\Utility\Filesyste\FilteredDirectoryIterator; mkdir('./foo'); touch('./foo/bar'); symlink('./foo/bar', './foo/baz'); mkdir('./foo/bam'); var_dump( iterator_to_array( (new FilteredDirectoryIterator('./foo')) ->setDotFiles(false) ->setFileTypes(FilteredDirectoryIterator::FILE_TYPE_FILE | FilteredDirectoryIterator::FILE_TYPE_DIRECTORY) ) ); // [DirectoryIterator("./foo/bar"), DirectoryIterator("./foo/bam")]
Testing
The library is tested by unit tests using PHP Unit.
To execute the tests, install the composer dependencies (including the dev-dependencies), switch into the tests
directory and run the following command:
../vendor/bin/phpunit
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-12-01