anhpha/lexik-jwt-service-provider

There is no license information available for the latest version (1.0) of this package.

This is a provider for silex 2.0 using lexik jwt authentication provider class to create a encoder

1.0 2016-10-26 10:03 UTC

This package is not auto-updated.

Last update: 2024-04-22 11:50:13 UTC


README

JWT encoder provider for Silex 2.0 based on LexikJWTAuthenticationBundle

Usage

  $ttl = 86400;
        $exp = time() + $ttl;
        $token = $this->container['lexikEncoder']()->encode(['username' => 'test', 'exp' => $exp]);
        $response = new JsonResponse();
        $response->setData(array(
            'token' => $token,
        ));
        //$response = new JsonResponse();
        return $response;