1. Go to this page and download the library: Download g4t/easyroute 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/ */
g4t / easyroute example snippets
namespace App\Http\Controllers;
use G4T\EaseRoute\Attributes\Route;
use G4T\EaseRoute\Attributes\Get;
use G4T\EaseRoute\Attributes\Post;
#[Route(uri: 'users', middleware: ['auth'])]
class UserController extends Controller
{
#[Get]
public function index()
{
return "List of users";
}
#[Get(onController: true)]
public function show($id)
{
return "User: $id";
}
#[Post('create')]
public function store()
{
return "Create user";
}
}