germania-kg/namespaced-filefinder

可用于在命名空间目录中查找文件

1.0.1 2021-01-11 07:38 UTC

This package is auto-updated.

Last update: 2024-09-11 15:51:22 UTC


README

Germania KG · NamespacedFileFinder

安装

$ composer require germania-kg/namespaced-filefinder

用法

构造函数需要一个默认目录进行查找。可选的数组包含“命名空间”目录,定义了也要查找的位置

<?php

use Germania\NamespacedFileFinder\NamespacedFileFinder;  

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

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

单元测试

可以将 phpunit.xml.dist 复制到 phpunit.xml 并根据需要修改,或者保持原样。运行 PhpUnit 测试或 composer 脚本,例如这样

$ composer test
# or
$ vendor/bin/phpunit