O'Reilly logo

CouchDB and PHP Web Development Beginner's Guide by Tim Juravich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — creating a get function in our Bones class

Let's create a get function at the top of the lib/bones.php file, right after the<?php tag and before we define the Bones class:

/Library/Webserver/Documents/verge/lib/bones.php

<?php
ini_set('display_errors','On');
error_reporting(E_ERROR | E_PARSE);
function get($route, $callback) {
Bones::register($route, $callback);
}

class Bones {
...
}

What just happened?

This function lies in the lib/bones.php file and is called for each get route that you have defined in your index.php file. This function is a simple pass-through function that hands off the route and callback to the register function of Bones.

Are we on the same page?

We did a whole lot in this section. Let's double check that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required