devhelp / resource-core
abstraction over resource that can read content of itself
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 0
Open Issues: 0
pkg:composer/devhelp/resource-core
Requires
- php: >=5.3
Requires (Dev)
This package is not auto-updated.
Last update: 2025-09-28 00:23:52 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)