Yes, it is possible (never actually done this, following is just a tip by reading the code).
You'll need to create a subclass of Silex\Application
, and overwrite the run()
function to something like this:
public function run(Request $request = null)
{
if (null === $request) {
$request = MySmartRequest::createFromGlobals();
}
$response = $this->handle($request);
$response->send();
$this->terminate($request, $response);
}
To avoid duplication, you can try this:
public function run(Request $request = null)
{
if (null === $request) {
$request = MySmartRequest::createFromGlobals();
}
parent::run($request);
}