1. Go to this page and download the library: Download sigareng/nam 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/ */
Nam::get('/', function() {
echo 'Im a GET request!';
});
Nam::post('/', function() {
echo 'Im a POST request!';
});
Nam::any('/', function() {
echo 'I can be both a GET and a POST request!';
});
Nam::dispatch();
use Nam\Nam;
Nam::get('/', function() {
Nam::render('./view/head.php');
Nam::render('./view/body.php');
Nam::render('./view/footer.php');
});
Nam::dispatch();
Nam::error(function() {
echo '404 :: Not Found';
});
use Nam;
Nam::get('/', 'Controllers\see@index');
Nam::get('page', 'Controllers\see@page');
Nam::get('view/(:num)', 'Controllers\see@view');
Nam::dispatch();
namespace Controllers;
class Demo {
public function index()
{
echo 'home';
}
public function page()
{
echo 'page';
}
public function view($id)
{
echo $id;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.