Skip to content

Latest commit

 

History

History
executable file
·
43 lines (31 loc) · 678 Bytes

README.md

File metadata and controls

executable file
·
43 lines (31 loc) · 678 Bytes

Iroute

Iroute::get('/', function() {
  echo 'Hello world!';
});

Iroute::dispatch();

Iroute also supports lambda URIs, such as:

Iroute::get('/(:any)', function($slug) {
  echo 'The slug is: ' . $slug;
});

Iroute::dispatch();

You can also make requests for HTTP methods in Macaw, so you could also do:

Iroute::get('/', function() {
  echo 'I <3 GET commands!';
});

Iroute::post('/', function() {
  echo 'I <3 POST commands!';
});

Iroute::dispatch();

Lastly, if there is no route defined for a certain location, you can make Iroute run a custom callback, like:

Iroute::error(function() {
  echo '404 :: Not Found';
});