Description
mixed route(string $route, Closure $callback)
Create a route for your app, which is placed in your start.php.
Parameters
$route
URL route to connect to your callback
$callback
Callback function to call when your route has been reached.
Examples
<?php // Example URL: http://localhost/foo route('/foo', function() { echo "Hello World!"; }); /** * Example URL: http://localhost/bar/{{ custom_id }} * * Here we pass a 2nd segment to our route, which could * be the ID of an item. Since its unique we prefix it * with a colon */ route('/bar/:id', function($id) { echo $id; }); /** * Example URL: http://localhost/posting * * You can also chain other methods to your route. * Here we use the accept() method to only accept * POST requests to this route. */ route('/posting', function() { echo "Accepting only POST data."; print_r($_POST); })->accept('POST');