devhelp / resource-core
There is no license information available for the latest version (dev-master) of this package.
abstraction over resource that can read content of itself
dev-master
2015-04-04 13:18 UTC
Requires
- php: >=5.3
Requires (Dev)
This package is not auto-updated.
Last update: 2024-12-21 19:15:59 UTC
README
please check composer website for more information.
$ composer require 'devhelp/resource-core'
Purpose
Provides abstraction over resource that can read content of itself
Usage
Usage of FileResource
$resource = new FileResource($filePath); $resource->getContent(); // returns content of file at $filePath
Usage of ResourcesChain
$chain = new ResourcesChain([ new FileResource($filePath), new JsonResource() ]); $chain->getContent(); // returns json decoded as array from file at $filePath
Collecting Resources
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[]
Credits
Brought to you by : Devhelp.pl (http://devhelp.pl)