1. Go to this page and download the library: Download bjornbasar/karhu-skeleton 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/ */
bjornbasar / karhu-skeleton example snippets
$app = new Karhu\App();
$app->router()->scanControllers(
namespace App\Controllers;
use Karhu\Attributes\Route;
use Karhu\Http\Request;
use Karhu\Http\Response;
final class GreetController {
#[Route('/greet/{name}', methods: ['GET'])]
public function greet(Request $request): Response {
return (new Response())->json(['hello' => $request->routeParams()['name']]);
}
}