diff --git a/composer.json b/composer.json index 0cca148f9..68f0ca603 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,8 @@ "slim/psr7": "^1.3.0", "monolog/monolog": "^3.0", "twig/twig": "^3.0", - "slim/twig-view": "^3.0" + "slim/twig-view": "^3.0", + "alrik11es/cowsayphp": "^1.2" }, "require-dev": { "heroku/heroku-buildpack-php": "*" diff --git a/composer.lock b/composer.lock index 85cccad59..b7e1172df 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,66 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0aa7148272c380d8d4d48317eb390443", + "content-hash": "64ddf7a335147fbd677355bc9b70c2d6", "packages": [ + { + "name": "alrik11es/cowsayphp", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/alrik11es/cowsayphp.git", + "reference": "080dc10c8f5420fef35163569293601f17124eeb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/alrik11es/cowsayphp/zipball/080dc10c8f5420fef35163569293601f17124eeb", + "reference": "080dc10c8f5420fef35163569293601f17124eeb", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "require-dev": { + "phpunit/phpunit": "5.*", + "scrutinizer/ocular": "~1.1" + }, + "bin": [ + "bin/cowsayphp" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Cowsayphp\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marcos Sigueros", + "email": "alrik11es@gmail.com", + "homepage": "https://github.com/alrik11es", + "role": "Developer" + } + ], + "description": "Cowsay port in PHP", + "homepage": "https://github.com/alrik11es/cowsayphp", + "keywords": [ + "cowsay" + ], + "support": { + "issues": "https://github.com/alrik11es/cowsayphp/issues", + "source": "https://github.com/alrik11es/cowsayphp/tree/master" + }, + "time": "2016-08-25T07:53:44+00:00" + }, { "name": "fig/http-message-util", "version": "1.1.5", diff --git a/views/database.twig b/views/database.twig new file mode 100644 index 000000000..dd0fb30b3 --- /dev/null +++ b/views/database.twig @@ -0,0 +1,14 @@ +{% extends "layout.html" %} + +{% block content %} +
Got these rows from the database:
+ +".$animal->say("Cool beans").""); + return $response; +}); +$app->get('/db', function(Request $request, Response $response, LoggerInterface $logger, Twig $twig, PDO $pdo) { + $st = $pdo->prepare('SELECT name FROM test_table'); + $st->execute(); + $names = array(); + while($row = $st->fetch(PDO::FETCH_ASSOC)) { + $logger->debug('Row ' . $row['name']); + $names[] = $row; + } + return $twig->render($response, 'database.twig', [ + 'names' => $names, + ]); +}); $app->run();