PHP SDK

This guide explains how to interact with the API using the PHP client.


Installation

composer require fortisx/sdk

Initialization

require 'vendor/autoload.php';

use FortisX\SDK\API;

$api = new API('YOUR_API_KEY');

Constructor options

Name
Type
Default
Description

$apiKey

string

API key used for authorization

$baseUrl

string

https://api.fortisx.fi/v1

Override if using a custom environment

$timeout

int

10

Request timeout in seconds


Methods

Method
Arguments
Returns
Description

get(string $endpoint, array $params = [])

endpoint path, optional params

array

Performs a GET request

post(string $endpoint, array $data = [])

endpoint path, optional data

array

Performs a POST request

put(string $endpoint, array $data = [])

endpoint path, optional data

array

Performs a PUT request

delete(string $endpoint)

endpoint path

array

Performs a DELETE request

All requests use GuzzleHttp\Client and automatically include the following headers:


Error Handling

When a network or server error occurs, an exception of type APIError is thrown.

Field
Type
Description

$message

string

Short description of the error

$status

int

HTTP status code

$details

array

Full response body if available

Example:


Example: /ping Endpoint

Last updated