Montonio PHP SDK v2.0
v2 modernizes the SDK for PHP 8.2+ while keeping the upgrade seamless — your existing code works without changes.
Highlights
PSR-18 HTTP Client Support — Bring your own HTTP client (Guzzle, Symfony HttpClient, or any PSR-18 implementation) or keep using the built-in cURL transport. Makes the SDK testable with mock HTTP clients and compatible with any framework.
Typed Enums — Environment, PaymentMethod, and PaymentStatus backed enums with full IDE autocomplete. Existing string constants still work (deprecated, removed in v3).
Granular Exception Handling — Catch exactly the errors you care about: AuthenticationException, ValidationException, NotFoundException, RateLimitException, ServerException. Existing catch (RequestException) blocks continue to work.
Static create() Factory — All structs now support a create() method with named parameters for a clean, modern construction style:
$refund = CreateRefundData::create(
orderUuid: $uuid,
amount: 10.00,
);What's New
- PHP 8.2+ minimum (8.0/8.1 users: v1 is maintained with full API coverage)
- PSR-18/PSR-17/PSR-7 support — optional, cURL remains the default
- 3 backed enums:
Environment,PaymentMethod,PaymentStatus - 7 new exception types mapped to HTTP status codes
AbstractStruct::create()static factory with named parameters- PHPUnit 11, CI tested on PHP 8.2–8.5
Upgrading
For most users, composer require makstech/montonio-php-sdk:^2.0 is all you need. No code changes required.
See the full upgrade guide for details on deprecations and new features.