Installation & Configuration

The official PHP SDK for the Felloh payments API. Use it to manage bookings, transactions, payment links, and all other Felloh resources from your PHP backend.

- Packagist Package

- Github Repository


Installation

The SDK requires PHP 8.1 or later. It uses Guzzle for HTTP requests.

Install the SDK

composer require felloh/php-sdk

Quick Start

Import the FellohClient and FellohConfig classes and create an instance with your API keys. The client handles authentication, token management, retries, and pagination automatically.

Your API keys can be created and managed from the Felloh dashboard. See the API Keys resource for managing keys programmatically.

Quick Start

use Felloh\FellohClient;
use Felloh\FellohConfig;

$client = new FellohClient(new FellohConfig(
    publicKey: $_ENV['FELLOH_PUBLIC_KEY'],
    privateKey: $_ENV['FELLOH_PRIVATE_KEY'],
));

// List bookings
$bookings = $client->bookings->list([
    'organisation' => 'your-org-id',
]);
print_r($bookings['data']);

Configuration Options

The FellohConfig constructor accepts the following named parameters.

Parameters

  • Name
    publicKeyrequired
    Type
    string
    Description

    Your Felloh public API key.

  • Name
    privateKeyrequired
    Type
    string
    Description

    Your Felloh private API key.

  • Name
    baseUrl
    Type
    string
    Description

    Base URL for the Felloh API. Defaults to https://api.felloh.com.

  • Name
    timeout
    Type
    float
    Description

    Request timeout in seconds. Defaults to 30.0.

  • Name
    maxRetries
    Type
    int
    Description

    Number of automatic retries on 5xx or network errors. Defaults to 2. Uses exponential backoff.

  • Name
    tokenRefreshBuffer
    Type
    int
    Description

    Seconds before token expiry to proactively refresh. Defaults to 60.

  • Name
    logger
    Type
    Closure
    Description

    Optional callback invoked after every HTTP request for logging and observability. Receives a LogEntry object.

Full Configuration

use Felloh\FellohClient;
use Felloh\FellohConfig;
use Felloh\LogEntry;

$client = new FellohClient(new FellohConfig(
    publicKey: 'your-public-key',
    privateKey: 'your-private-key',
    baseUrl: 'https://api.felloh.com',
    timeout: 30.0,
    maxRetries: 2,
    tokenRefreshBuffer: 60,
    logger: function (LogEntry $entry) {
        echo "{$entry->method} {$entry->url} → "
           . "{$entry->statusCode} ({$entry->durationMs}ms)\n";
    },
));

Token Management

The SDK automatically handles JWT token acquisition and refresh. Tokens are cached in memory and proactively refreshed before expiry based on the tokenRefreshBuffer setting. No manual token management is needed.

If a request receives a 401 response, the SDK will automatically refresh the token and retry the request once.


Available Resources

Every resource on the Felloh API is accessible through a property on the client instance.

ResourceClient PropertyDocumentation
Organisations$client->organisationsOrganisations
Bookings$client->bookingsBookings
Booking Components$client->bookingComponentsBooking Components
Transactions$client->transactionsTransactions
Customers$client->customersCustomers
Payment Links$client->paymentLinksPayment Links
Ecommerce$client->ecommerceEcommerce
Refunds$client->refundsRefunds
Charges$client->chargesCharges
Chargebacks$client->chargebacksChargebacks
Credit Notes$client->creditNotesCredit Notes
Suppliers$client->suppliersSuppliers
Beneficiaries$client->beneficiariesBeneficiaries
Disbursements$client->disbursementsDisbursements
Ledger$client->ledgerLedger
Acquirer Settlement$client->batchesAcquirer Settlement
API Keys$client->apiKeysAPI Keys
Audit$client->auditAudit
AISP$client->aispAISP
Scheduled Payments$client->scheduledPaymentsScheduled Payments
Enums$client->enumsEnums