承接 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
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

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