PHP code example of namelivia / travelperk-http-php

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

    

namelivia / travelperk-http-php example snippets


use Namelivia\TravelPerk\ServiceProvider;
$isSandbox = false;
$travelperk = (new ServiceProvider())->build('your-api-key', $isSandbox);

use Namelivia\TravelPerk\ServiceProvider;
$isSandbox = false;
$travelperk = (new ServiceProvider())->buildOAuth2(
  'your-client-id',
  'your-client-secret',
  'http://your-app/redirect-url',
  ['expenses:read', 'scim:read'],
  $isSandbox
);

$travelperk->expenses()->invoices()->all();
bash
$ composer