Skip to content

Instantly share code, notes, and snippets.

@alganet
Created September 17, 2012 02:30
Show Gist options
  • Save alganet/3735253 to your computer and use it in GitHub Desktop.
Save alganet/3735253 to your computer and use it in GitHub Desktop.
Framework-style Respect\Rest controllers
<?php
class MyUser implements Routable, Routinable, ProxyableWhen
{
public $path = '/users';
//Routinable
public function applyRoutines(AbstractRoute $route)
{
$route->userAgent(array('firefox' => function($data) {
return makeMoreAwesome($data);
}));
}
//ProxyableWhen
public function when()
{
return isset($_GET['crazy_idea_key']);
}
public function get()
{
return array("John", "Carl");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment