定制 methorz/filesystem 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

methorz/filesystem

最新稳定版本:1.0.0

Composer 安装命令:

composer require methorz/filesystem

包简介

MethorZ - Filesystem

README 文档

README

Overview

The FileSystem Library is a PHP package that provides a comprehensive representation of files and directories. It includes functionality for reading, scanning, copying, renaming, and removing files and directories, with support for recursive operations and filtering based on extensions, directories, and file names.

Features

  • File and Directory Representation: Classes to represent files and directories.
  • Recursive Operations: Support for recursive scanning, copying, and removing of directories.
  • Filtering: Ability to ignore specific file extensions, directories, and files during operations.
  • Unit Tests: Comprehensive unit tests to ensure the functionality of the library.

Installation

Install the package via Composer:

composer require methorz/filesystem

Usage

Reading a File or Directory

use MethorZ\FileSystem\FileSystem;
use MethorZ\FileSystem\Directory;
use MethorZ\FileSystem\File;

$path = '/path/to/your/file/or/directory';
$recursiveScan = true;
$extensions = ['txt', 'php'];

$fsObject = FileSystem::read($path, $recursiveScan, $extensions);

if ($fsObject instanceof Directory) {
    echo "It's a directory!";
} elseif ($fsObject instanceof File) {
    echo "It's a file!";
}

Copying Files and Directories

use MethorZ\FileSystem\FileSystem;

$source = '/path/to/source';
$destination = '/path/to/destination';

FileSystem::copy($source, $destination);

Ignoring Specific Files, Directories, and Extensions

use MethorZ\FileSystem\FileSystem;

FileSystem::ignoreExtensions(['log', 'tmp']);
FileSystem::ignoreDirectories(['cache', 'logs']);
FileSystem::ignoreFiles(['README.md', '.gitignore']);

Creating and Removing Directories

use MethorZ\FileSystem\FileSystem;

$path = '/path/to/new/directory';
FileSystem::createDirectory($path);

FileSystem::remove($path);

License

This project is licensed under the MIT License. See the LICENSE file for details.

Author

MethorZ - methorz@spammerz.de

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any changes.

This README provides an overview of the FileSystem Library, including installation instructions, usage examples, and information on running unit tests. For more detailed documentation, please refer to the source code and comments within the library.

统计信息

  • 总下载量: 13
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2024-08-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固