php >= 5.6
> composer require lucid/resource
<?php
use Lucid\Resource\Locator;
$locator = new Loacor(['/path/to/dirA', '/path/to/dirB']);
foreach ($locator->locate('config.php') as $resource) {
$resource->... // do stuff
}
<?php
use Lucid\Resource\FileResource;
$res = new FileResource($file);
$res->getResource(); // returns "/path/file"
$res->isValid($time) // if not mofified since $time
<?php
use Lucid\Resource\ObjectResource;
use Acme\MyObject;
$res = new ObjectResource(new MyObject);
$res->getResource(); // returns "/path/to/Acme/MyObject.php
$res->isValid($time) // if not mofified since $time
<?php
use Lucid\Resource\Collection;
use Lucid\Resource\FileResource;
use Lucid\Resource\ObjectResource;
$resources = new Collection();
$resources->addResource(new ObjectResource($onject));
$resources->addResource(new FileResource($file));
$resources->addObjectResource($object);
$resources->addFileResource($file);
$resources->all(); // [ObjectResource $resource, FileResource $resource, ... ]
$resources->isValid(time()); // bool