PHP code example of nerova / sdk

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

    

nerova / sdk example snippets




ttp\Promise\FulfilledPromise;
use Http\Promise\Promise;
use Microsoft\Kiota\Abstractions\Authentication\AccessTokenProvider;
use Microsoft\Kiota\Abstractions\Authentication\AllowedHostsValidator;
use Microsoft\Kiota\Abstractions\Authentication\BaseBearerTokenAuthenticationProvider;
use Microsoft\Kiota\Http\GuzzleRequestAdapter;
use Nerova\Sdk\NerovaPartnerClient;

final class NerovaApiKeyProvider implements AccessTokenProvider
{
    public function __construct(private string $apiKey) {}

    public function getAuthorizationTokenAsync(string $url, array $additionalAuthenticationContext = []): Promise
    {
        return new FulfilledPromise($this->apiKey);
    }

    public function getAllowedHostsValidator(): AllowedHostsValidator
    {
        return new AllowedHostsValidator(['api.nerovasystems.com']);
    }
}

$apiKey = getenv('NEROVA_API_KEY') ?: throw new RuntimeException('NEROVA_API_KEY is 

use Nerova\Sdk\Api\V1\Tenants\TenantsRequestBuilderPostRequestConfiguration;
use Nerova\Sdk\Models\CreateTenantV1Request;

$body = new CreateTenantV1Request();
$body->setDisplayName('Demo Salon');
$body->setExternalReference('your-crm-id-123');

$configuration = new TenantsRequestBuilderPostRequestConfiguration(
    headers: ['Idempotency-Key' => 'provision-tenant-your-crm-id-123']
);
$created = $client->api()->v1()->tenants()->post($body, $configuration)->wait();