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.
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
LogEntryobject.
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.
| Resource | Client Property | Documentation |
|---|---|---|
| Organisations | $client->organisations | Organisations |
| Bookings | $client->bookings | Bookings |
| Booking Components | $client->bookingComponents | Booking Components |
| Transactions | $client->transactions | Transactions |
| Customers | $client->customers | Customers |
| Payment Links | $client->paymentLinks | Payment Links |
| Ecommerce | $client->ecommerce | Ecommerce |
| Refunds | $client->refunds | Refunds |
| Charges | $client->charges | Charges |
| Chargebacks | $client->chargebacks | Chargebacks |
| Credit Notes | $client->creditNotes | Credit Notes |
| Suppliers | $client->suppliers | Suppliers |
| Beneficiaries | $client->beneficiaries | Beneficiaries |
| Disbursements | $client->disbursements | Disbursements |
| Ledger | $client->ledger | Ledger |
| Acquirer Settlement | $client->batches | Acquirer Settlement |
| API Keys | $client->apiKeys | API Keys |
| Audit | $client->audit | Audit |
| AISP | $client->aisp | AISP |
| Scheduled Payments | $client->scheduledPayments | Scheduled Payments |
| Enums | $client->enums | Enums |
