Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kherge-archive/php-file-locator
A simple file locator library.
https://github.com/kherge-archive/php-file-locator
Last synced: about 2 months ago
JSON representation
A simple file locator library.
- Host: GitHub
- URL: https://github.com/kherge-archive/php-file-locator
- Owner: kherge-archive
- License: mit
- Archived: true
- Created: 2013-01-16T19:05:46.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-02-20T00:32:48.000Z (almost 12 years ago)
- Last Synced: 2024-04-14T17:03:10.348Z (9 months ago)
- Language: PHP
- Size: 309 KB
- Stars: 20
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-php-cn - PHP File Locator - 一个在大型项目中定位文件的库 (目录 / 文件 Files)
README
File Locator
============[![Build Status](https://travis-ci.org/herrera-io/php-file-locator.png)](http://travis-ci.org/herrera-io/php-file-locator)
A simple file locator library.
Summary
-------The **FileLocator** library was created to provide file locating capabilities to a larger project. It can be used in templating engines, configuration file loaders, and more.
Installation
------------Add it to your list of Composer dependencies:
```sh
$ composer require herrera-io/file-locator=1.*
```Usage
-----The library includes `FileSystemLocator`, which can be used to search one or more directory paths. Either a single directory path, or an array of paths may be passed to the constructor.
```php
locate('file.ini'); // return the first "file.ini" found
$files = $locator->locate('file.ini', false); // find all named "file.ini"
```You can also create your own custom file locator by implementing the interface, `LocatorInterface`. All locator classes bundled in the library also implement this interface, allowing drop-in replacement.
```php
add(new FileSystemLocator('/path/to/dir'));
$locators->add(new CustomLocator());$file = $locator->locate('file.ini'); // return the first "file.ini" found
$files = $locator->locate('file.ini', false); // find all named "file.ini"
```