Skip to content

Instantly share code, notes, and snippets.

@kurozumi

kurozumi/silex-cli.php

Last active Jan 25, 2016
Embed
What would you like to do?
【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