Skip to content

Instantly share code, notes, and snippets.

@igorw
Created November 9, 2011 11:08
Show Gist options
  • Save igorw/1351142 to your computer and use it in GitHub Desktop.
Save igorw/1351142 to your computer and use it in GitHub Desktop.
/path/to/php-5.4.0beta2/sapi/cli/php -S localhost:8080 -t web -d 'error_log=error.log' -d 'log_errors=1' web/index_dev.php
<?php
// src/app.php
require_once __DIR__.'/../vendor/silex.phar';
$app = new Silex\Application();
$app['debug'] = true;
$app->get('/', function () {
return "Hello World!";
});
$app->get('/foo', function () {
return "Bar!";
});
return $app;
<?php
// web/index.php
$app = require __DIR__.'/../src/app.php';
$app->run();
<?php
// web/index_dev.php
if ('/favicon.ico' === $_SERVER['REQUEST_URI']) {
header('HTTP/1.0 204 No Content');
exit;
}
if (is_file(__DIR__.$_SERVER['REQUEST_URI']) && !in_array($_SERVER['REQUEST_URI'], array('/', '/index.php'))) {
return false;
} else {
require __DIR__.'/index.php';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment