PHP code example of austinhyde / paperboat

1. Go to this page and download the library: Download austinhyde/paperboat library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

austinhyde / paperboat example snippets


$stream = new PaperBoat\JsonStream();
$stream
  ->startObject()
  ->property('data')
  ->startArray();

$i = 0;
while ($row = $pdoStmt->fetch(PDO::FETCH_ASSOC)) {
  $i++;
  $stream->value($row);
}

$stream
  ->stopArray()
  ->property('meta')
  ->startObject()
    ->property('count', $i)
  ->stopObject()
  ->stopObject();