Skip to content

Instantly share code, notes, and snippets.

@simensen
Created August 4, 2013 03:02
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save simensen/d1bbf1ed3a22bdbb5d9c to your computer and use it in GitHub Desktop.
<?php
use Symfony\Component\HttpFoundation\Request;
use Silex\Application;
use Dflydev\Stack\AuraFrameworkWrapper;
$app = new Application();
$app->get('/', function () {
return "Main Application!";
});
$app->get('/admin', function () {
return "Protected!";
});
$map = [
// Assume that there is a sibling directory named aura-demo-1.2.5
// that contains an Aura.Framework application. By creating the
// AuraFrameworkWrapper, it makes the Aura app effectively a Stack
// compatible Symfony HttpKernelInterface application... and can
// take advantage of all of the other things we can put on the stack
// like stack/oauth and stack/session.
//
// Assume the Aura demo application has a /protected path... we'll
// be protecting that with Stack Basic HTTP Authentication and
// aura doesn't even have to know about it.
"/aura-demo" => new AuraFrameworkWrapper(dirname(__DIR__).'/aura-demo-1.2.5'),
];
$app = (new Stack\Builder())
->push('Stack\Session')
->push('Dflydev\Stack\BasicAuthentication', [
'realm' => 'YAY!'
'firewall' => [
['path' => '/admin'],
['path' => '/aura-demo/protected']
]
])
->push('Stack\UrlMap', $map)
->resolve($app);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment