Download the PHP package its-pradeependra/postpin-php without Composer
On this page you can find all versions of the php package its-pradeependra/postpin-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download its-pradeependra/postpin-php
More information about its-pradeependra/postpin-php
Files in its-pradeependra/postpin-php
Package postpin-php
Short Description Official PHP SDK for the Postpin shipping-rate API
License MIT
Homepage https://postpin.in
Informations about the package postpin-php
its-pradeependra/postpin-php
Official PHP SDK for the Postpin shipping-rate API — calculate courier charges between Indian pincodes, check serviceability, look up the pincode directory, and verify webhooks.
- Zero Composer dependencies — uses
ext-curlandext-jsononly. - Robust by default — automatic retries with exponential backoff + jitter,
Retry-Aftersupport, per-request timeouts, and idempotency keys. - Typed exceptions — catch
RateLimitException,QuotaExceededException,ValidationException, and friends. - Secure webhooks — constant-time HMAC signature verification with replay protection.
- Testable — a
Transportinterface lets you inject a fake HTTP client.
Requirements
- PHP 8.1+ with
ext-curlandext-json.
Install
Quick start
Load your API key from the environment — never hard-code it.
Configuration
Resources
Each method returns an associative array decoded from the API response.
Error handling
Every failure throws a subclass of Postpin\Exception\PostpinException:
| Exception | HTTP | When |
|---|---|---|
AuthenticationException |
401 | Missing or invalid API key |
PermissionException |
403 | Key lacks the required scope |
ValidationException |
400 / 422 | Invalid parameters ($e->details) |
NotFoundException |
404 | Resource does not exist |
QuotaExceededException |
402 | Monthly quota used up |
RateLimitException |
429 | Too many requests ($e->retryAfter) |
ApiException |
5xx | Server-side error (auto-retried) |
TimeoutException |
— | Request exceeded the timeout |
ConnectionException |
— | Network failure after retries |
Every PostpinException exposes $errorCode, $statusCode, $requestId, $details, and $headers.
Webhooks
Verify against the raw request body — re-serializing the JSON breaks the signature.
verify() returns true or throws; constructEvent() verifies and returns the parsed event array. Both accept a $toleranceSeconds argument (default 300; 0 disables the replay check).
License
MIT © Postpin
All versions of postpin-php with dependencies
ext-curl Version *
ext-json Version *