PHP code example of wilkques / pkce-php

1. Go to this page and download the library: Download wilkques/pkce-php 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/ */

    

wilkques / pkce-php example snippets


use Wilkques\PKCE\Generator;

$codeVerifier = Generator::codeVerifier();

$codeChallenge = Generator::codeChallenge($codeVerifier);

// or

$pkce = Generator::generate();

$codeVerifier = $pkce->getCodeVerifier();

$codeChallenge = $pkce->getCodeChallenge();

// or

$codeVerifier = $pkce->codeVerifier;

$codeChallenge = $pkce->codeChallenge;

// or

$pkce->toArray(); // output ['codeVerifier' => '123', 'codeChallenge' => '456']

$pkce->toJson(); // output {'codeVerifier' : '123', 'codeChallenge' : '456'}