Name: silex-jwt
Owner: Codigo5
Description: Library for JWT work on Silex
Forked from: ofat/silex-jwt
Created: 2017-03-30 20:34:05.0
Updated: 2017-03-30 20:34:07.0
Pushed: 2017-03-30 21:53:23.0
Homepage: null
Size: 10
Language: PHP
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Library for work with JWT on Silex framework.
You can generate and check JWT tokens, use middleware for auth checking.
composer require ofat\silex-jwt
p
Ofat\SilexJWT\JWTAuth;
Silex\Application;
art our application
= new Silex\Application();
gister silex jwt service provider. Add jwt secret key
->register(new JWTAuth(),[
'jwt.secret' => 'test'
ample of jwt generating
->post('/login', function(Request $request) use ($app) {
$userId = 1;
$token = $app['jwt_auth']->generateToken($userId);
return $app->json(['token' => $token]);
ample of checking json web token
->get('/test', function(Request $request) use ($app) {
return $app->json(['test' => true]);
before(new JWTTokenCheck());