use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; $app->post('/message', function (Request $request) { mail( '[email protected]', 'New message', $request->get('body') ); return new Response('Email has been sent!', 201); });
Protected $app['lambda_parameter'] = $app->protect( function ($a, $b) { return $a + $b; }); // will not execute the lambda $add = $app['lambda_parameter']; // calling it now echo $add(2, 3);
use Silex\WebTestCase; class YourTest extends WebTestCase { public function createApp() { return require __DIR__.'/../src/app.php'; } // tests... } tests/YourTest.php