PHP code example of m1x0n / easy-pnr-api-php

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

    

m1x0n / easy-pnr-api-php example snippets




// Usage example

t you obtained correct API key
$apiKey = 'YOUR API KEY HERE';

// Prepare your PNR data. See encoded.txt for more information
$pnrSample = file_get_contents(__DIR__ . '/../tests/fixtures/encoded.txt');

// You can create client in two ways
// 1. Via constructor:
$client = new EasyPNR\Client($apiKey);

// 2. Via factory method:
$client = EasyPNR\Client::withApiKey($apiKey);

// This should respond with pong and timestamp string
$pingResponse = $client->ping();

// This should respond with decoded array structure
// See decoded.json fixture for more information
$decoded = $client->decode($pnrSample);