PHP code example of bigpoint / slim-bootstrap
1. Go to this page and download the library: Download bigpoint/slim-bootstrap 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/ */
bigpoint / slim-bootstrap example snippets
class SomeEndpoint implements SlimBootstrap\Endpoint\ResourceGet,
SlimBootstrap\Endpoint\Streamable
{
public function setOutputWriter(
SlimBootstrap\ResponseOutputWriterStreamable $outputWriter
) {
$this->_outputWriter = $outputWriter;
}
...
public function get(array $parameters) {
...
$dbResultStatement = $database->getDbResult(); //PDO Statement object
// fetching single db rows here to save memory
while (false !== ($entry = $dbResultStatement->fetch(
\PDO::FETCH_ASSOC,
\PDO::FETCH_ORI_NEXT
))) {
$this->_outputWriter->writeToStream(
$this->_createDataObject((int)$entry['id'], $entry)
);
}
...
}
...
}