PHP code example of jfm / simple-mvc-route-attributes-package
1. Go to this page and download the library: Download jfm/simple-mvc-route-attributes-package 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/ */
jfm / simple-mvc-route-attributes-package example snippets
use Jfm\SimpleMvcRouteAttributesPackage\Routing\RouteLoader;
RouteLoader::getInstance()->loadRoutes();
namespace App\Controller;
use JFM\SimpleMVCRouteAttributes\Route;
class HomeController extends AbstractController
{
#[Route('/')]
public function index()
{
// ...
}
// ...
}
namespace App\Controller;
use JFM\SimpleMVCRouteAttributes\Route;
class ItemController extends AbstractController
{
#[Route('/items')]
public function index()
{
// ...
}
#[Route('/items/show')]
public function show()
{
// ...
}
// ...
}