mathiasgrimm/glimpse-php

PHP SDK for glimpseimg.com: convert, optimize, resize, thumbnail and analyze images.

Maintainers

Package info

github.com/mathiasgrimm/glimpse-php

pkg:composer/mathiasgrimm/glimpse-php

Transparency log

Statistics

Installs: 240

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 1

v3.0.0 2026-07-20 17:31 UTC

README

glimpse: ship smaller images, skip the toolchain

Ship smaller images. Skip the toolchain.
Convert, optimize, resize, thumbnail and analyze images from any PHP application.
The official PHP SDK for glimpseimg.com, the image API for developers.

Latest Version on Packagist Tests Total Downloads PHP Version License

Shipping images means wrangling ImageMagick, libvips, mozjpeg, cwebp and avifenc: compiled binaries that differ between your laptop, your teammate's laptop, and production. glimpse-php replaces all of them with one method call, with zero binary dependencies. The heavy lifting happens on the Glimpse API: stateless, nothing stored, your bytes never linger. You require a single package and go:

composer require mathiasgrimm/glimpse-php
use MathiasGrimm\GlimpsePhp\Client;
use MathiasGrimm\GlimpsePhp\ImageFormat;
use Illuminate\Http\Client\Factory;

$glimpse = new Client(new Factory, 'your-api-token');

$avif = $glimpse->convert(file_get_contents('photo.jpg'), ImageFormat::Avif);
file_put_contents('photo.avif', $avif->bytes);

That is the whole integration: no extensions to compile, no binaries to pin, no queue of shell-outs to babysit. Every method returns typed, immutable results.

Documentation

The full documentation lives at glimpseimg.com/docs/sdk:

  • Installation: requirements and optional extensions.
  • Authentication: building the client and verifying tokens.
  • Methods: every method and the typed objects it returns.
  • Laravel: container wiring and Http::fake() in tests.
  • Errors: the exception hierarchy.

Upgrading from v1? The upgrade guide covers the move from array returns to typed objects.

Development

composer install
composer test        # Pint (check), PHPStan, and the Pest suite

Releasing

make release VERSION=vX.Y.Z

Runs the test suite, tags VERSION, pushes the tag, and creates the GitHub release. Packagist picks the new tag up through the GitHub webhook.

License

glimpse-php is open-source software licensed under the MIT license.

Prefer the terminal? glimpse-cli is the first-party CLI: the same API from your shell and CI, no PHP code required.
Grab a free API key at glimpseimg.com (Settings → API Tokens).