Download the PHP package austinhyde/paperboat without Composer
On this page you can find all versions of the php package austinhyde/paperboat. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package paperboat
PaperBoat - Streaming JSON Output
This is an extremely simple, and very alpha quality implementation of a Streaming JSON outputter.
Show me the goods
This outputs, for example,
Usage
The primary class you interact with is PaperBoat\JsonStream. The constructor takes an optional PaperBoat\OutputStream parameter, which tells it where to output JSON to. By default, this is a PaperBoat\OutputStream\StdoutStream, which just prints to STDOUT or the HTTP response.
The following methods construct JSON output:
startArray()- Begins outputting an array.stopArray()- Closes an array.startObject()- Begins outputting an object.stopObject()- Closes an object.property($name[, $data])- Adds a property to an object. If you do not provide the value here, you must callstartArray(),startObject(), orvalue()next.value($data)- Adds data to the stream, by JSON encoding it.
The following methods control how data is output:
setAutomaticFlushing($value)- Controls whether theOutputStreamis flushed automatically after data is written to the stream. Defaults to true. If you set this false, you are responsible for calling->flush()when appropriate.setJsonFlags($value)- Sets the flags passed tojson_encode()flush()- Simply calls the providedOutputStream'sflush()method.
Installation
Via Composer.
Contributing
See CONTRIBUTING
FAQ
Why PaperBoat?
Streams of lightweight data => paper boats floating down a stream of water
Why do I need this?
You would use this if you need to output a large amount of JSON data without holding the whole data structure in memory at once.
Most people probably don't need this.
Why did you make this?
- I was bored
- It didn't exist yet
- Someone might need it, someday
Are these really frequently asked questions?
No, this is a sham, just like all the other FAQs on GitHub.