crysalead/dir 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

crysalead/dir

最新稳定版本:2.0.4

Composer 安装命令:

composer require crysalead/dir

包简介

Recursive directory scanner to locate directories and/or files in a file system

README 文档

README

Build Status Code Coverage

Dir is a small library which allows to perform some recursive operations on directories.

Dir::scan()

Gets all nested directories and/or files present inside a directory.

$files = Dir::scan('my/dir',       // Can be a string path of an array of string paths
    [
        'include' => '*.txt',      // Can be an array of includes
        'exclude' => '*.save.txt', // Can be an array of excludes
        'type'    => 'file'        // Can be an array of types, possible values:
                                   // `'file'`, `'dir'`, `'executable'`, `'link'`, `'readable'`, `'writable'`
        'skipDots'       => true,  // Keeps '.' and '..' directories in result
        'leavesOnly'     => true,  // Keeps only leaves
        'followSymlinks' => true,  // Follows Symlinks
        'recursive'      => true   // Scans recursively,
        'copyHandler'    => function($path, $target) { // The copy handler
            copy($path, $target);
        }
    ]
);

Dir::copy()

Copies a directory with files recursively into a destination folder.

$files = Dir::copy('my/dir',       // A string path of an array of string paths
    'my/destination',              // A destination path (string only)
    [
        'mode'           => 0755,  // Mode used for directory creation
        'childrenOnly'   => false, // Copies the file inside 'my/dir' if `true`, otherwise `dir` will be
                                   // added as the root directory.
        'followSymlinks' => true,  // Follows Symlinks
        'recursive'      => true   // Scans recursively
    ]
);

Dir::remove()

Removes a directory and all its content recursively.

Dir::remove('my/dir',     // Can be a string path of an array of string paths
    [
        'followSymlinks' => false,        // Follows Symlinks
        'recursive'      => true,         // Scans recursively
        'include'        => '*.txt',      // Can be an array of includes
        'exclude'        => '*.save.txt', // Can be an array of excludes
    ]
);

Dir::make()

Makes nested directories.

$success = Dir::make('my/dir',  // Can be a string path of an array of string paths
    [
        'mode'      => 0755,         // Mode used for directory creation
        'recursive' => true,         // Scans recursively
        'include'   => '*.txt',      // Can be an array of includes
        'exclude'   => '*.save.txt', // Can be an array of excludes
    ]
);

Dir::tempnam()

Creates a temporary folder (like the tempnam() function but for directories).

$dir = Dir::tempnam(sys_get_temp_dir(), 'mytmp');

统计信息

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

GitHub 信息

  • Stars: 13
  • Watchers: 4
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-12-21