Download the PHP package kinetistack-io/php-sdk without Composer
On this page you can find all versions of the php package kinetistack-io/php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kinetistack-io/php-sdk
More information about kinetistack-io/php-sdk
Files in kinetistack-io/php-sdk
Package php-sdk
Short Description Framework-Agnostic PHP Client Library for KinetiStack API
License MIT
Homepage https://kinetistack.io
Informations about the package php-sdk
KinetiStack PHP SDK
Framework-Agnostic PHP Client Library for KinetiStack API.
Installation
Usage
Initialization
HTTP Client Flexibility (PSR-18 & Symfony)
The SDK is strictly framework-agnostic. It does not force a concrete HTTP client implementation:
- Auto-Discovery: If
httpClientis omitted ornull,php-http/discoveryautomatically discovers any installed PSR-18 client (such as Guzzle) or Symfony's HTTP Client. - PSR-18 (Guzzle, etc.): Inject any
Psr\Http\Client\ClientInterfaceinstance directly (e.g.new KinetiClient($host, $key, $guzzleClient)). - Symfony HTTP Client: Existing Symfony projects can inject
Symfony\Contracts\HttpClient\HttpClientInterfacefor full backward compatibility.
Transient Error Retries & Backoff
When max_retries is configured in $options, the SDK automatically retries transient HTTP errors:
- HTTP 429 (Too Many Requests): Automatically delays subsequent retries by respecting the server's
Retry-Afterresponse header (or falls back to exponential backoff). - HTTP 503 (Service Unavailable): Automatically retries using exponential backoff.
- Non-transient errors (such as HTTP 400, 401, 403, 404, 422, or 500) fail immediately without retrying.
If all retry attempts are exhausted, the corresponding typed exception (e.g., RateLimitException or ServiceUnavailableException) is thrown.
Synchronous Image Analysis
Batch Processing
Exponential Backoff & Polling Constants
waitForBatchJob() implements an adaptive polling strategy with jitter:
- Exponential progression: Polling begins at
$pollIntervalSeconds(default:2s) and doubles on each subsequent check (e.g.,2s -> 4s -> 8s -> 10s). - Interval cap: The sleep interval between checks never exceeds
$maxPollIntervalSeconds(default:10s). - Randomized jitter: A randomized jitter between 0 and 500ms is added to every sleep duration to prevent synchronized polling spikes across distributed workers.
- Progress monitoring: The optional
$onProgresscallback receives the updatedBatchJobDtoon each poll check.
Default constants exposed on KinetiClient:
KinetiClient::DEFAULT_POLL_INTERVAL_SECONDS=2KinetiClient::DEFAULT_MAX_POLL_INTERVAL_SECONDS=10KinetiClient::DEFAULT_TIMEOUT_SECONDS=60
Webhook Verification
Verify incoming HMAC-SHA256 signatures for webhook events (e.g. from the X-Kineti-Signature header):
Error Handling
The SDK maps HTTP error responses to typed exceptions (RFC 9457 compliant):
Note on Transient Errors: When
max_retriesis specified in client options (e.g.,['max_retries' => 3]), transient HTTP errors (429 Too Many RequestsrespectingRetry-Afterheader, and503 Service Unavailable) are automatically retried with exponential backoff before throwingRateLimitExceptionorServiceUnavailableException.
Admin API (AdminClient)
The SDK provides AdminClient as a dedicated sibling client for administrative operations under /api/v1/admin/*, authenticated via LexikJWT Bearer tokens (Authorization: Bearer <jwt>).
Initialization & Authentication
Organizations & Projects
API Key Management
Usage & Analytics
Development
No local PHP or Composer installation is required. Everything runs in one-off Docker containers via docker compose and make.
Prerequisites
- Docker & Docker Compose
make
Common Commands
CI/CD & Release Workflow
The SDK uses automated CI/CD workflows for testing, static analysis, and releases:
- CI Pipeline (
.github/workflows/ci.yml): Runs on pushes and pull requests targetingmain. Executes test matrices across PHP 8.1, 8.2, 8.3, and 8.4, followed by PHP CS Fixer and PHPStan static analysis. - Release Pipeline (
.github/workflows/release.yml): Triggered automatically when a version tag matchingv*.*.*(e.g.,v1.0.0) is pushed to the repository.- Validation (
validate): Checks platform requirements viacomposer check-platform-reqsand runs PHPUnit across PHP 8.1, 8.2, 8.3, and 8.4. - Quality Checks (
quality-checks): Ensures code conforms to PSR-12 and passes PHPStan Level 8 static analysis. - Release (
release): Requires bothvalidateandquality-checksto pass. Publishes a GitHub Release (with auto-generated release notes and automatic pre-release detection) and triggers a synchronization webhook to the Packagist API via authenticated cURL.
- Validation (
Required Repository Secrets
The release workflow requires the following repository secrets to be configured in GitHub:
| Secret Name | Description | Required By |
|---|---|---|
PACKAGIST_USER |
Packagist account username authorized to manage kinetistack-io/php-sdk |
Packagist API update hook |
PACKAGIST_TOKEN |
Packagist API token with package update permissions | Packagist API update hook |
The workflow also requires GitHub Actions default GITHUB_TOKEN with contents: write permissions (configured automatically in release.yml) to publish releases. Fork runs automatically skip the release job if secrets are not configured.
Contributing
Contributions are welcome! Please refer to CONTRIBUTING.md for detailed local development, testing, and release guidelines.
Before opening a pull request, ensure that:
- Code adheres to PSR-12 standards (
make cs-check/make cs-fix). - Static analysis passes at PHPStan Level 8 (
make phpstan). - Unit tests pass across all supported PHP versions (
make test-all). - All checks pass locally via
make checkbefore opening a pull request.
Security
If you discover a security vulnerability within this SDK, please send an email to [email protected] or use GitHub Private Vulnerability Reporting. All security vulnerabilities will be promptly addressed.
License
The KinetiStack PHP SDK is open-sourced software licensed under the MIT license.
All versions of php-sdk with dependencies
php-http/discovery Version ^1.19
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.0 || ^2.0