Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Last active January 25, 2016 04:11
Show Gist options
  • Save kurozumi/c3c499f853675aa21be8 to your computer and use it in GitHub Desktop.
Save kurozumi/c3c499f853675aa21be8 to your computer and use it in GitHub Desktop.
【Silex】Silexをコマンドラインから実行する方法
<?php
require_once 'vendor/autoload.php';
use Symfony\Component\HttpFoundation\Request;
$app = new Silex\Application();
$app->get('/', function(Request $request){
// do something
});
if(count($argv) < 3)
return;
list($file, $method, $path) = $argv;
$request = Request::create($path, $method);
$app->handle($request);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment