youngmedia-pl/europa-sdk

There is no license information available for the latest version (v2.1.3) of this package.

TU Europa SDK for PHP

v2.1.3 2020-04-19 20:04 UTC

This package is auto-updated.

Last update: 2024-09-24 06:26:34 UTC


README

This repository contains the PHP SDK that allows you to access the TU Europa API from your PHP project.

Installation

The Europa PHP SDK can be installed with Composer. Run this command:

composer require youngmedia-pl/europa-sdk

Usage

Simple example of getting quotes.

<?php

require_once __DIR__ . '/vendor/autoload.php'; // change path as needed

$europa = new Europa\Europa([
    'customer_id' => '{customer-id}',   // the private customer identifier
    'environment' => 'dev',             // change to 'prod' for production environment (default)
]);

// Use our helper class for sport competition insurance.
$helper = $europa->getSportCompetitionInsuranceHelper();

// Get quotes.
try {
    $quotes = $helper->getQuotes([
        'competition_end_date'      => '2024-12-31',
        'competition_start_date'    => '2024-12-31',
        'is_professional'           => false,
        'participant_birth_date'    => '1950-12-31',
        'participation_fee'         => '60.99',
        'sum_insured'               => '30000',
    ]);
} catch (Europa\Exceptions\EuropaResponseException $e) {
    // When API returns an error.
    echo 'API returned an error: ' . $e->getMessage();
    exit;
} catch (Europa\Exceptions\EuropaSDKException $e) {
    // Other issues.
    echo 'Europa SDK returned an error: ' . $e->getMessage();
    exit;
}

// Print details.
var_dump($quotes);