Skip to content

Instantly share code, notes, and snippets.

@mfolnovic
Created December 5, 2010 21:41
Show Gist options
  • Save mfolnovic/729496 to your computer and use it in GitHub Desktop.
Save mfolnovic/729496 to your computer and use it in GitHub Desktop.
PHP Controllers with Filters (Rails-like)
<?php
/* This example shows how usage of rails filters could look like in php */
class NewsController {
/**
* @before_filter online
* @cache (ttl: 3600)
*/
public function show() {
...
}
private function online() {
return isset($_SESSION["ID"]);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment