please check composer website for more information.
$ composer require 'devhelp/resource-core'
Provides abstraction over resource that can read content of itself
$resource = new FileResource($filePath);
$resource->getContent(); // returns content of file at $filePath
$chain = new ResourcesChain([
new FileResource($filePath),
new JsonResource()
]);
$chain->getContent(); // returns json decoded as array from file at $filePath
ResourceCollector together with ResourceIterator implementations are designed to return collection of Resource instances.
There are no implementations of ResourceIterator but they might exist for example for:
- files
- arrays
- web pages
- etc...
$myIterator = new MyResourceIterator();
$collector = new ResourceCollector($myIterator);
$resources = $collector->collect(); //returns Resource[]
Brought to you by : Devhelp.pl (http://devhelp.pl)