Open up the index.php
file and add the following two routes so that we can test our new code:
<?php include 'lib/bones.php'; get('/', function($app) { echo "Home"; }); get('/signup', function($app) { echo "Signup!"; });
We just created two routes for our Bones
class to handle /
(which is the root URL) and /signup
.
There are a few things to notice in the code that we just added:
Our two
get
routes are now clean, little functions, including our route and a function that will act as our callback functionOnce the function is executed, we are using
echo
to display the simple textWhen a route is matched and a callback is executed from
Bones
, the instance ofBones
is returned as the variable$app
, which can be used anywhere in the callback function