Skip to content

Instantly share code, notes, and snippets.

@gsdevme
Created March 16, 2012 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gsdevme/2048978 to your computer and use it in GitHub Desktop.
Save gsdevme/2048978 to your computer and use it in GitHub Desktop.
Quick app() function for PHP 5.2 with slim
<?php
require 'Slim/Slim.php';
function app()
{
static $app;
if(gettype($app) != 'object'){
$app = new Slim();
}
return $app;
}
function test()
{
app()->response()->body('hello world');
}
app()->get('/', 'test');
app()->run();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment