PHP code example of fedyak / php-yc-iamtoken

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

    

fedyak / php-yc-iamtoken example snippets



// Service Account ID
$service_account_id = '....';

// Service Account Key ID
$key_id             = '....';

$rsa_private_key = file_get_contents('private.pem');

$iam = new ServiceAccountIAMToken($service_account_id, $key_id, $rsa_private_key);

//$jwt = $iam->getJWT();        //JSON Web Token

$iam_token = $iam->getIAMToken();