As stated in SOEN I guess that’s how it is:
$app = new Silex\Application();
$app['controllers']->requireHttps();
$app->get('/', function () use ($app) {
    return 'Olá mundo!';
});
$app->run();
Documentation in Silex\Controller::requireHttps
Note:
Wallace left a hint, if you are in HTTPS development environment you may not need it, then you can detect if the script is in debug mode, like this:
$app = new Silex\Application();
if (!$app['debug']) {
   $app['controllers']->requireHttps();
}
Or to make it simple:
$app = new Silex\Application();
$app['debug'] || $app['controllers']->requireHttps();
You can also set this by .htaccess as I explained in:
Example:
# Redireciona para o HTTPS independente do domínio
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Adiciona www. no prefixo do domínio
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
							
							
						 
The idea is cool, pity that has to define in route by route :\
– Wallace Maxters
@Wallacemaxters this one
requireHttpsis "extended", I believe you can define in thebefore– Guilherme Nascimento
I tried to use in the
before, didn’t work out :\– Wallace Maxters
Try calling it that in the
before:$app['controllers']->requireHttps();, didn’t work out so well :\– Wallace Maxters
@Wallacemaxters I’m installing and I’ll rephrase the answer
– Guilherme Nascimento
I sent you a message on the website, I found out what it’s like... Add it there, because I don’t want to answer :p
– Wallace Maxters