anhpha/lexik-jwt-service-provider

此包最新版本(1.0)没有可用的许可证信息。

这是一个使用 Lexik JWT 认证提供者类创建编码器的 Silex 2.0 提供者。

1.0 2016-10-26 10:03 UTC

This package is not auto-updated.

Last update: 2024-09-23 13:36:57 UTC


README

基于 LexikJWTAuthenticationBundle 的 Silex 2.0 JWT 编码器提供者

用法

  $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;