PHP code example of netherphp / avenue
1. Go to this page and download the library: Download netherphp/avenue 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/ */
netherphp / avenue example snippets
$Config = Nether\Avenue\Library::PrepareDefaultConfig();
$Router = new Nether\Avenue\Router($Config);
$Router->Run();
namespace Routes;
use Nether\Avenue;
class Home
extends Avenue\Route {
#[Avenue\Meta\RouteHandler('/index')]
public function
Index():
void {
echo 'Home Page.';
return;
}
#[Avenue\Meta\RouteHandler('/dashboard')]
#[Avenue\Meta\ConfirmWillAnswerRequest]
public function
Dashboard():
void {
echo 'User Dashboard.';
return;
}
public function
DashboardWillAnswerRequest():
int {
$User = YourAppSessionLib::GetCurrentUser();
if($User && $User->CanHasDashboard())
return Avenue\Response::CodeOK;
return Avenue\Response::CodeForbidden;
}
#[Avenue\Meta\ErrorHandler(403)]
public function
HandleForbidden():
void {
echo "Dude No.";
return;
}
#[Avenue\Meta\ErrorHandler(404)]
public function
HandleNotFound():
void {
echo "Bruh Wut?";
return;
}
}