Skip to content

Instantly share code, notes, and snippets.

@anvarazizov
Created May 19, 2015 07:59
Show Gist options
  • Save anvarazizov/769f11871a9312e8cea8 to your computer and use it in GitHub Desktop.
Save anvarazizov/769f11871a9312e8cea8 to your computer and use it in GitHub Desktop.
Fat-free framework JSON API route example
$f3->route('GET /api/user/@id',
function($f3) {
$id = $f3->get('PARAMS.id');
header('Content-Type: application/json');
$data = array('id'=>$id, 'name'=>'Taras', 'lastname'=>'Shevchenko');
echo json_encode($data);
}
);
@VincentProuchet
Copy link

your code saved me from headhache. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment