This package provides Comparators for the file system, i.e. for SplFileInfo objects. They can be used with the sorting and comparing tools in the Comparable package.
The package requires PHP 5.4 or later and the Comparable package in version 1.0 or later.
Via Composer
$ composer require sgh/comparable-filesystemThe following comparators are available:
- FileATimeComparator
- FileCTimeComparator
- FileMTimeComparator
- FileNameComparator
- FileSizeComparator
- FileTypeComparator
You can use all the methods in \SGH\Comparable\SortFunctions and \SGH\Comparable\SetFunctions with the comparators.
If you prefer, you can also use the factory method ::callback() to retrieve a comparison callback, that can be used
in any function that expects a user defined comparison callback:
usort($arrayOfFiles, \SGH\Comparable\Filesystem\Comparator\FileSizeComparator::callback());
$ phpunitPlease see CONTRIBUTING for details.
If you discover any security related issues, please email fschmengler@sgh-it.eu instead of using the issue tracker.
- Fabian Schmengler(https://github.com/schmengler)
- All Contributors
The MIT License (MIT). Please see License File for more information.