for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Flatdown\Controllers;
use Flatdown\Application;
use Psr\Http\Message\ServerRequestInterface;
class IndexController
{
public function __invoke(ServerRequestInterface $req, array $params, Application $app)
$index_filename = $app->getConfig('content_path') . '/index.md';
if (file_exists($index_filename)) {
return $app->get('markdown.page', [$index_filename]);
} else {
return $app->getResponse(302)
->withHeader('location', $app->getConfig('base_url') . '/_index');
}
public function index(ServerRequestInterface $req, array $params, Application $app)
$data = ['files' => $app->get('markdown.files'), 'window_title' => 'Flatdown - Index'];
return $app->get('templates')->render('index', $data);
public function about(ServerRequestInterface $req, array $params, Application $app)
$index_filename = $app->getConfig('base_path') . '/README.md';