1. Go to this page and download the library: Download akara/ci4_route_generator 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/ */
akara / ci4_route_generator example snippets
namespace App\Controllers;
use Akara\RouteGenerator\RoutePath;
use CodeIgniter\Controller;
class UserController extends Controller
{
#[RoutePath('/users', 'get')]
public function index()
{
// Your logic here
}
#[RoutePath('/users/{id}', 'get', ['auth'])]
public function show($id)
{
// Your logic here
}
}
namespace App\Controllers;
use Akara\RouteGenerator\RoutePath;
use App\Filters\SessionFilters;
use CodeIgniter\Controller;
class UserController extends Controller
{
#[RoutePath('/users', 'GET')]
public function index()
{
// Your logic here
}
#[RoutePath('/users/{id}', 'GET', [SessionFilters::class])]
public function show($id)
{
// Your logic here
}
}