Language guides
The HTML to Image API is a REST API. Any language that can make an HTTP request will work. The guides below cover seven stacks, plus the three official SDK clients, with idiomatic code, queueing patterns, and template integration.
Pick your language
- HTML to Image in PHP - choose this if you work in any PHP environment without a framework.
- PHP SDK - the official typed client, installed with Composer. Recommended for most PHP and Laravel apps.
- HTML to Image in Laravel - choose this if you use Laravel and want the Http facade and queue integration.
- Laravel Package - the official package with a facade, config file and storage helpers. Recommended for Laravel 11 and 12 apps.
- HTML to Image in Ruby on Rails - choose this for Ruby on Rails apps using Active Job and Action Mailer.
- HTML to Image in Python - choose this for Flask, Django, FastAPI or data pipeline use.
- HTML to Image in JavaScript and Node.js - choose this for any Node-based backend or serverless function.
- JavaScript SDK - the official typed client, installed from npm. Recommended for most Node.js, React and Vue apps.
- HTML to Image in React - choose this for server-side or client-triggered rendering inside a React app.
- HTML to Image in Vue - choose this for Vue and Nuxt apps.
Every example assumes you have an API key. If you have not signed up yet, see the quick start.
Official SDKs and integrations
Prefer a maintained package over hand-rolled HTTP calls? These are built and maintained by us:
- PHP SDK - a typed client for the HTML, screenshot and template endpoints. Install with
composer require html2img/html2img-php. Source on GitHub. - Laravel Package - an auto-registered facade with a config file, storage helpers and an artisan test command, built on the PHP SDK. Install with
composer require html2img/html2img-laravel. Source on GitHub. - JavaScript SDK - a zero-dependency typed client for Node.js, Bun, Deno and edge runtimes, with full TypeScript types and dual ESM/CommonJS builds. Install with
npm install @html2img/client. Source on GitHub. - Auto Open Graph Images for Statamic - a Statamic 6 addon that automatically renders branded Open Graph images for every entry from your own Antlers or Blade templates. Install with
composer require html2img/statamic-og-images.
Common features across guides
- HTML to Image conversion via the
htmlendpoint - Screenshot generation via the
screenshotendpoint - Templates via the
/api/v1/templates/{slug}endpoint - Error handling for 400, 401, 402, 504 and 500 responses
- File storage for storing returned URLs
- Environment variable patterns for API keys
- Account and credit checks via
GET /api/me
See also
- Templates gallery - pre-built designs you can render with a single JSON call.
- Parameters reference - every option the API accepts.
- Examples - worked code samples for specific image shapes.