|» Metadata||» Status|
Here's a little class to allow accessing a traversable variable (array, Iterator, etc...) as a stream using callbacks. The variable is transversed and each key/value is passed to the callback(s) to be transformed into a string to be piped into the stream. The stream is read forward-only, and has an undetermined length.
I first developed this class to use with MDB2_Iterator and HTTP_Download (note that HTTP_Download needs the patch of bug #13125 to handle undetermined content size.)
With PHP 5.3+ there will be stream context support for copy(). That will allow to very easily dump data to file (see example)
(assuming "foreach" is the name of the registered protocol):
"key" and "value" specify which of the key and value should be passed to the callback and in which order.
If not specified, "key:value" will be assumed. So protocol://subject
Callback / Formatter in URL
To each of the URL examples above you can append a query string made up of. These substitute for the context options, possibly leading to more self-explanatory URLs.
* Documentation / more examples (besides the test suite)
|» Dependencies||» Links|
|» Timeline||» Changelog|