2017 © Pedro Peláez
 

library flyfinder

Flysystem plugin to add file finding capabilities to the Filesystem entity

image

phpdocumentor/flyfinder

Flysystem plugin to add file finding capabilities to the Filesystem entity

  • Thursday, June 14, 2018
  • by mvriel
  • Repository
  • 2 Watchers
  • 6 Stars
  • 9,765 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 4 Versions
  • 20 % Grown

The README.md

License: MIT Scrutinizer Code Coverage Scrutinizer Code Quality Stable Version Unstable Version, (*1)

FlyFinder

FlyFinder is a utility class for Flysystem that will enable you to find files based on certain criteria., (*2)

FlyFinder can search for files that are hidden (either because they are hidden files themselves, or because they are inside a hidden directory), that have a certain extension, or that exist in a certain path., (*3)

Flyfinder does not return directories themselves... only files., (*4)

Installation

The easiest way to install this library is with Composer using the following command:, (*5)

$ composer require phpdocumentor/flyfinder

Examples

Ready to dive in and don't want to read through all that text below? Just consult the examples folder and check which type of action that your want to accomplish., (*6)

Usage

In order to use the FlyFinder plugin you first need a Flyfinder filesystem with an adapter, for instance the local adapter., (*7)

use League\Flysystem\Filesystem;
use League\Flysystem\Local\LocalFilesystemAdapter as LocalAdapter;
use Flyfinder\Finder;

$filesystem = new Filesystem(new LocalAdapter(__DIR__.'/path/to/files/'));

Now you can create the Finder instance:, (*8)

$finder = new Finder($filesystem); 

FlyFinder will need specifications to know what to look for. The following specifications are available:, (*9)

  • IsHidden (this specification will return true when a file or directory is hidden,
  • HasExtension (this specification will return true when a file or directory has the specified extension),
  • InPath (this specification will return true when a file is in the given path. Wildcards are allowed.)
    • note that this path should be considered relative to the $filesystem's path

Specifications can be instantiated as follows:, (*10)

use Flyfinder\Path;
use Flyfinder\Specification\IsHidden;
use Flyfinder\Specification\HasExtension;
use Flyfinder\Specification\InPath;

$isHidden = new IsHidden();
$hasExtension = new HasExtension(['txt']);
$inPath = new InPath(new Path('mydir'));

Combining specifications

You can search on more criteria by combining the specifications. Specifications can be chained as follows:, (*11)

$isHidden->andSpecification($hasExtension) will find all files and directories that are hidden AND have the given extension., (*12)

$isHidden->orSpecification($hasExtension) will find all files and directories that are hidden OR have the given extension., (*13)

$isHidden->notSpecification will find all files and directories that are NOT hidden., (*14)

You can also make longer chains like this:, (*15)

$specification = $inPath->andSpecification($hasExtension)->andSpecification($isHidden->notSpecification());, (*16)

This will find all files in the given path, that have the given extension and are not hidden., (*17)

The Versions

14/06 2018

dev-master

9999999-dev http://www.phpdoc.org

Flysystem plugin to add file finding capabilities to the Filesystem entity

  Sources   Download

MIT

The Requires

 

The Development Requires

phpdoc flysystem

18/01 2018

1.0.0-beta2

1.0.0.0-beta2 http://www.phpdoc.org

Flysystem plugin to add file finding capabilities to the Filesystem entity

  Sources   Download

MIT

The Requires

 

The Development Requires

phpdoc flysystem

10/12 2017

1.0.0-beta1

1.0.0.0-beta1 http://www.phpdoc.org

Flysystem plugin to add file finding capabilities to the Filesystem entity

  Sources   Download

MIT

The Requires

 

The Development Requires

phpdoc flysystem

18/08 2015

1.0.0-alpha1

1.0.0.0-alpha1 http://www.phpdoc.org

Flysystem plugin to add file finding capabilities to the Filesystem entity

  Sources   Download

MIT

The Requires

 

The Development Requires

phpdoc flysystem