PHP code example of holkerveen / hi-framework
1. Go to this page and download the library: Download holkerveen/hi-framework 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/ */
holkerveen / hi-framework example snippets
namespace App\Controllers;
use Hi\Attributes\Route;
use Hi\Attributes\AllowAccess;
use Hi\Enums\Role;
use Twig\Environment;
class HomeController
{
#[Route('/')]
#[AllowAccess(Role::Unauthenticated)]
public function index(Environment $twig): string
{
return $twig->render('home.html.twig');
}
#[Route('/admin')]
#[AllowAccess(Role::Authenticated)]
public function admin(Environment $twig): string
{
return $twig->render('admin.html.twig');
}
}