1. Go to this page and download the library: Download vs-point/rb-premium 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/ */
vs-point / rb-premium example snippets
use VsPoint\RBPremium\RBPremiumClient;
use VsPoint\RBPremium\RBPremiumConfig;
use VsPoint\RBPremium\Enum\Environment;
$config = new RBPremiumConfig(
clientId: 'your-client-id', // X-IBM-Client-Id
certPath: '/path/to/cert.pem', // PEM certifikát (může obsahovat i klíč)
certPassword: null, // heslo certifikátu (pokud šifrovaný)
keyPath: null, // PEM klíč zvlášť (pokud není v certPath)
keyPassword: null,
environment: Environment::Sandbox, // nebo Environment::Production
);
$client = RBPremiumClient::create($config);
use VsPoint\RBPremium\RBPremiumClient;
use VsPoint\RBPremium\RBPremiumInlineConfig;
use VsPoint\RBPremium\Enum\Environment;
$config = new RBPremiumInlineConfig(
clientId: 'your-client-id',
certPem: getenv('RB_CERT_PEM'), // PEM string certifikátu (může obsahovat i klíč)
certPassword: null, // heslo certifikátu (pokud šifrovaný)
keyPem: getenv('RB_KEY_PEM'), // PEM string klíče zvlášť (pokud není v certPem)
keyPassword: null,
environment: Environment::Production,
);
$client = RBPremiumClient::create($config);
use VsPoint\RBPremium\RBPremiumClient;
use VsPoint\RBPremium\RBPremiumInlineConfig;
use VsPoint\RBPremium\Enum\Environment;
$p12Content = file_get_contents('/path/to/cert.p12');
if (!openssl_pkcs12_read($p12Content, $certs, 'heslo-k-p12')) {
throw new \RuntimeException('Nepodařilo se načíst .p12 certifikát: ' . openssl_error_string());
}
$config = new RBPremiumInlineConfig(
clientId: 'your-client-id',
certPem: $certs['cert'],
keyPem: $certs['pkey'],
environment: Environment::Production,
);
$client = RBPremiumClient::create($config);