1. Go to this page and download the library: Download rakaaditya/panada-router 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/ */
namespace Controllers;
use Rakaaditya\PanadaRouter\Routes as Route;
class AliasController
{
public function index()
{
$route = new Route;
$route->get('coba', 'HomeController@index');
$route->get('{username}/{id}/{slug}', 'ArticleController@detail');
// Let's run through the route!!
$route->run();
}
}
// GET
$route->get('posts', 'PostController@posts');
// POST
$route->post('posts/create', 'PostController@create');
// PUT
$route->put('posts/{id}/update', 'PostController@update');
// DELETE
$route->delete('posts/{id}/delete', 'PostController@delete');