1. Go to this page and download the library: Download stnc/macaw2 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/ */
Macaw::get('/(:any)', function($slug) {
echo 'The slug is: ' . $slug;
});
Macaw::dispatch();
Macaw::get('/', function() {
echo 'I'm a GET request!';
});
Macaw::post('/', function() {
echo 'I'm a POST request!';
});
Macaw::any('/', function() {
echo 'I can be both a GET and a POST request!';
});
Macaw::dispatch();
Macaw::error(function() {
echo '404 :: Not Found';
});
use NoahBuscher\Macaw\Macaw;
Macaw::get('/', 'Controllers\demo@index');
Macaw::get('page', 'Controllers\demo@page');
Macaw::get('view/(:num)', 'Controllers\demo@view');
Macaw::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.