1. Go to this page and download the library: Download cooky/url-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/ */
cooky / url-router example snippets
/* main index.php */
te;
/* basic get */
Route::get('/', function (){
echo '<h2>home page</h2>';
});
/* controller */
Route::get('/home', 'Home@Index');
/* with parameter */
Route::get('user/profile/{id}', 'User@Profile');
Route::post('test/post/{id}', function ($id){
echo $id;
});
Route::complete();
use View\Loader;
/* Home controller - every controller must be extends with Loader for view */
class Home extends Loader
{
public function index(){
$data['test'] = 'hello kitty';
$this->view('main', $data);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.