PHP code example of thearyanahmed / ppp

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

    

thearyanahmed / ppp example snippets


use Thearyanahmed\Ppp\Request;
$response = (new Request)->fetchPPP('DE');

# SuccessResponse
    public function getCountryCodeAlpha2() : string
    public function getCountryCodeAlpha3() : string
    public function getMainCurrencyName() : string
    public function getMainCurrencySymbol() : string
    public function getPppConversionFactor() : float
    public function getPPP() : float
    public function isSuccessful() : bool # will always return true

# ErrorResponse
    public function getMessage() : string
    public function isSuccessful() : bool # will always return false

   $response = (new Request)->fetchPPP('DE');

   if($response->isSuccessful()) {
        $discountPrice = $response->getPppConversionFactor() * $originalPrice;
   }