1. Go to this page and download the library: Download jakobjohansson/kiwi 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/ */
jakobjohansson / kiwi example snippets
/*
* Routes file.
* You can create your own custom routes in here, at the end of this file.
*/
$router->get('', 'PageController/index');
$router->get('post/{id}', 'PageController/show');
/**
* Render the main page.
*
* @return void
*/
public function index()
{
View::render('index', ['posts' => Post::all()]);
}
/**
* Render a specific post page.
*
* @param Post $post
*
* @return void
*/
public function show(Post $post)
{
if (!$post) {
throw new HttpException("That post doesn't exist.");
}
View::render('post', ['post' => $post]);
}