Skip to content

Instantly share code, notes, and snippets.

@alganet
Created March 30, 2012 00:00
Show Gist options
  • Save alganet/2245063 to your computer and use it in GitHub Desktop.
Save alganet/2245063 to your computer and use it in GitHub Desktop.
Seamless Respect Framework
<?php
//A framework built entirely by components, no conectors (this is a mock!)
use Respect\Template;
use Respect\Validation as v;
use Respect\Rest;
use Respect\Persistence;
$router = new Rest;
$mapper = new Relational;
$template = new Template;
$router->get('/users/*', function($username) use ($mapper) {
return $mapper->user(compact('username'))->fetch();
})->accept(array(
'text/html' => $template('users.html');
))->when(v::attribute('username')->alnum('_')->length(1,15));
@jeanpimentel
Copy link

I liked!

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