PHP code example of maciejkosiarski / jwt-keeper-bundle

1. Go to this page and download the library: Download maciejkosiarski/jwt-keeper-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

maciejkosiarski / jwt-keeper-bundle example snippets



// config/bundles.php

return [
    // ...
    MaciejKosiarski\JwtKeeperBundle\JwtKeeperBundle::class => ['all' => true],
    // ...
];




namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstarctController;
use MaciejKosiarski\JwtKeeperBundle\Service\JwtKeeper;

class AppController extends AbstarctController
{
    public function index()
    {
        $jwtKeeper = new JwtKeeper('http://super-service/jwt', 'username', 'superpass');
        //return JWT in string
        $jwtKeeper->getToken();
        //return JWT in object
        $jwtKeeper->getJwt();
    }
    
    // ...
    
}