germania-kg/namespaced-filefinder

Callable to find files in namespaced directories

1.0.1 2021-01-11 07:38 UTC

This package is auto-updated.

Last update: 2024-11-11 16:13:45 UTC


README

Germania KG · NamespacedFileFinder

Installation

$ composer require germania-kg/namespaced-filefinder

Usage

The constructor requires a default directory to look in. An optional array with “namespaced” directories defines where to also have a look:

<?php

use Germania\NamespacedFileFinder\NamespacedFileFinder;  

$finder = new NamespacedFileFinder("/path/configs", [
  "@custom" => "/path/to/custom/configs"
]);

$found = $finder("app.yaml");
$found = $finder("@custom/app.yaml");

Unit tests

Either copy phpunit.xml.dist to phpunit.xml and adapt to your needs, or leave as is. Run PhpUnit test or composer scripts like this:

$ composer test
# or
$ vendor/bin/phpunit