Disq的流畅接口使得遍历和操作文件系统变得更加容易。

dev-master 2015-04-21 17:54 UTC

This package is auto-updated.

Last update: 2024-09-18 00:07:58 UTC


README

#Disq

Disq 是一个非常小的库,适用于 PHP 5.4+,它使得遍历和操作文件系统更加容易。它提供了一个简单、流畅的接口,应该会让熟悉 jQuery 的用户感到熟悉。

##示例

另请参阅 tests/examples.php

###列出当前目录下的所有文件

Disq(__DIR__ . '/*.*')->each(function () {
    //The Disq class (partially) decorates `SplFileInfo`, which is where `getRealPath()` comes from.
    print $this->getRealPath() . "\n";
});
Disq('*.*', __DIR__)->each(function () {
    print $this->getRealPath() . "\n";
});
Disq('*', __DIR__)->each(function () {
    if ($this->isFile()) {
        print $this->getRealPath() . "\n";
    }
});
Disq('*.*', __DIR__)->each(function () {
    //`getInfo()` returns a `SplFileInfo` object for the current matched path.
    print $this->getInfo()->getRealPath() . "\n";
});

##安装

使用 Composer 进行安装。

composer require danbettles/disq:dev-master

##待办事项

  • 插件。