PHP code example of vivahr / vivahr-php

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

    

vivahr / vivahr-php example snippets




use VIVAHR\Auth\Authentication;

$client_id = 'XXXXXXXXXX';
$client_secret = 'XXXXXXXXXXXXXXXX';

// Use this for Production
$api_url = 'https://auth.vivahr.com';

// Use this for Sandbox testing
$api_url = 'https://api-sandbox.vivahr.com';

$auth_token_path = '/oauth/token';

$auth = new Authentication($client_id , $client_secret, $api_url . $auth_token_path);
$accessTokenData = $auth->generateAccessToken();
$accessToken = $accessTokenData['access_token'];

use VIVAHR\VivahrClient;

$vivahrClient = new VivahrClient($accessToken, $api_url);


$jobs = $vivahrClient->jobs()->list([
    "offset"=> "",
    "limit"=> "",
    "keyword"=> "",
    "department_id"=> "",
    "location_id"=> "",
    "sort_field"=> "",
    "sort_direction"=> "",
    "hide_inactive"=> ""
]);
echo json_encode($jobs);

try {
    // Your API call here
} catch (\VIVHAR\Exceptions\ApiException $e) {
    echo "Error: " . $e->getMessage();
}
bash
composer