giveitsmaller / sdk
PHP SDK for GISL (Give It Smaller) compression service
Requires
- php: ^8.1
- giveitsmaller/contracts: ^0.70.0
- php-http/discovery: ^1.19
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
- psr/http-message: ^1.1 || ^2.0
Requires (Dev)
- guzzlehttp/guzzle: ^7.12.1
- guzzlehttp/psr7: ^2.12.1
- http-interop/http-factory-guzzle: ^1.2
- phpstan/phpstan: ^2
- phpunit/phpunit: ^10
- symfony/yaml: ^6.4.40 || ^7.4.12
Suggests
None
Provides
None
Conflicts
- guzzlehttp/guzzle: <7.12.1
- guzzlehttp/psr7: <2.12.1
Replaces
None
README
The official PHP SDK for Give It Smaller (GISL) — a file compression and media-processing service. Compress, convert, thumbnail, and merge images, video, audio, and documents from PHP 8.1+.
Read-only mirror. This repository is automatically published from Give It Smaller's private monorepo on each release. Do not open issues or pull requests here — they are not monitored. Licensed under Apache-2.0.
📖 Full documentation: giveitsmaller.com
Install
The SDK code-targets PSR-18 / PSR-17 and resolves a concrete HTTP client at runtime via php-http/discovery. Install the SDK plus any PSR-18 implementation — Guzzle is the path of least resistance:
composer require giveitsmaller/sdk guzzlehttp/guzzle http-interop/http-factory-guzzle
Requires PHP ^8.1.
Bring your own PSR-18 client. The SDK's runtime imports only PSR-18 interfaces, so you can use any implementation (e.g. Symfony HttpClient) instead of Guzzle — inject it via
Gisl::create(httpClient: ...). Published on Packagist — thecomposer requireabove is all you need (norepositoriesblock or auth token).
Quickstart
The SDK is file-first: you always start from a file (->file($path) for one,
->files([$paths]) for many) and call operations on it.
<?php require 'vendor/autoload.php'; use Gisl\Sdk\Gisl; use Gisl\Sdk\Generated\SdkSpec\Enums\OptimizeFor; $client = Gisl::create(apiKey: 'sk_...'); // or rely on GISL_API_KEY / ~/.gisl/credentials $result = $client ->file('./photo.jpg') ->compress(optimize: OptimizeFor::Balanced) ->run(maxWait: '5m'); echo $result->url; // pre-signed download URL
Operation-first also ships. A lower-level
$client->compress($path, [...])->run(new RunOptions(...))form (andthumbnail/convert) is available as an escape hatch, but file-first is the recommended direction.
Documentation
Full documentation — getting started, the client reference and ergonomic builders, operation options, progress events (SSE), webhooks, error/retry guidance, and per-operation examples — lives at giveitsmaller.com.
License
Apache-2.0 — see the LICENSE file.