gonzalo123 / silex-gae-login-provider
Google App Engine Login provider for Silex
Installs: 34
Dependents: 0
Suggesters: 0
Security: 0
Stars: 10
Watchers: 5
Forks: 2
Open Issues: 1
pkg:composer/gonzalo123/silex-gae-login-provider
Requires
- php: >=5.4.0
- silex/silex: 1.0.*@dev
This package is not auto-updated.
Last update: 2026-02-09 21:21:04 UTC
README
Google App Engine Login provider for Silex
Usage example:
Google app engine configuration:
application: silexgae
version: 1
runtime: php
api_version: 1
threadsafe: true
handlers:
- url: .*
script: main.php
Silex Application:
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Silex\Application;
use Gae\LoginProvider;
use Gae\Auth;
$app = new Application();
$app->register(new LoginProvider(), array(
'auth.onlogin.callback.url' => '/private',
'auth.onlogout.callback.url' => '/loggedOut',
));
/** @var Auth $auth */
$auth = $app['gae.auth']();
$app->get('/', function () use ($app, $auth) {
return $auth->isLogged() ?
$app->redirect("/private") :
"<a href='" . $auth->getLoginUrl() . "'>login</a>";
});
$app->get('/private', function () use ($app, $auth) {
return $auth->isLogged() ?
"Hello " . $auth->getUser()->getNickname() . " <a href='" . $auth->getLogoutUrl() . "'>logout</a>" :
$auth->getRedirectToLogin();
});
$app->get('/loggedOut', function () use ($app) {
return "Thank you!";
});
$app->run();