Download the PHP package html-css-to-image/client without Composer

On this page you can find all versions of the php package html-css-to-image/client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package client

HTML/CSS to Image PHP Client

The official PHP client for the HTML/CSS to Image API. It provides immutable request and response models, signed URL helpers, and an injectable PSR-18 HTTP transport.

This README documents how the client behaves. The central API documentation is the source of truth for rendering features, parameter meanings, supported values, plan availability, and API limits. See the parameter reference when configuring a request.

Installation

PHP 8.2 or newer is required.

Quick start

Credentials are available in the HCTI dashboard. Keep the API key on a trusted server; never embed it in browser, desktop, or mobile application code.

Environment credentials

Set HCTI_API_ID and HCTI_API_KEY, then use:

fromEnvironment() throws RuntimeException when either variable is missing.

Requests and responses

Request constructors use PHP-style camelCase named arguments. The client maps them to the API's snake_case fields. null fields are omitted from JSON payloads; an explicit false is preserved for normal POST requests.

Request class Use
CreateHtmlCssImageRequest Create an image from HTML and CSS.
CreateUrlImageRequest Capture a URL.
CreateTemplatedImageRequest Render a saved template with values.

All supported fields are documented by property types and PHPDoc. Their API behavior is documented in the parameter reference, URL screenshot guide, and template guide.

createImage() returns either CreateImageSuccessResponse or ApiErrorResponse. Use instanceof to narrow the result to the appropriate response type. The success property remains available as a convenience. HTTP transport failures are raised by the PSR-18 client rather than converted into API responses, and a malformed successful API response raises UnexpectedValueException.

Batch requests

Only HTML/CSS and URL requests can be batched. Empty html or url values in variations are omitted so they can inherit from defaultOptions. An empty variation list returns a successful empty result without sending an HTTP request. Options unsupported by the batch API, such as dedupeDurationS, are not serialized. See the batch API documentation.

Signed URLs

The signed URL helpers perform no network request. They create the exact query string, sign it with HMAC-SHA256 using the API key, and return a URL that can be shared without exposing that key.

Use generateTemplatedImageUrl() when you already have a complete CreateTemplatedImageRequest. Use generateTemplatedImageUrlFromValues() as a convenience when you have a template ID and values. Both methods accept renderOptions.

Client behavior worth knowing:

See the signed URL documentation for endpoint behavior and security considerations.

Image URLs and render options

imageUrl() builds a URL for an existing image without making a request:

Cropping uses immutable value objects and explicit factory methods:

The crop factories validate their inputs before generating a URL. Refer to the image URL and cropping documentation for transformation semantics and limits.

Deleting images

Every successful 2xx response maps to DeleteImageSuccessResponse. API errors use ApiErrorResponse, while network failures remain PSR-18 exceptions.

HTTP configuration

The default transport is a persistent Guzzle client with a 30-second timeout and no automatic retries. Inject any PSR-18 ClientInterface to configure timeouts, retries, proxies, certificates, connection limits, or test behavior:

The injected HTTP client remains caller-owned and is never closed or reconfigured by this package. Every API request includes HCTIPHP/<version> as its User-Agent, including requests sent through an injected client. Retry policy intentionally belongs to the application and can be added through the selected PSR-18 client's middleware or handler system.

Error handling

Client API

Method Returns Interaction
fromEnvironment(...) HtmlCssToImageClient Reads credentials from the environment.
createImage($request) success or error response Sends POST /v1/image.
createImageBatch($variations, $defaultOptions = null) batch success or error response Sends POST /v1/image/batch, unless the list is empty.
deleteImage($imageId) delete success or error response Sends DELETE /v1/image/{id}.
deleteImageBatch($imageIds) delete success or error response Sends DELETE /v1/image/batch.
imageUrl($imageId, $renderOptions = null) string Builds an existing-image URL locally.
generateTemplatedImageUrl($request, $renderOptions = null) string Builds and signs a template URL from a request object locally.
generateTemplatedImageUrlFromValues(...) string Builds and signs a template URL from an ID and values locally.
generateCreateAndRenderUrl(...) string Builds and signs a URL screenshot locally.

HtmlCssToImageClient implements HtmlCssToImageClientInterface. Public request, response, PDF, and render/crop classes include PHPDoc for their constructors, properties, parameters, return types, exceptions, and IDE help.

Development

Releasing

Packagist derives package versions from Git tags, so composer.json intentionally has no version field. To release, update VERSION in a pull request and merge it into main. After CI passes, the release workflow checks Packagist, creates the matching vX.Y.Z tag and GitHub Release when needed, and Packagist indexes the tag through its GitHub integration.

License

MIT


All versions of client with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
composer-runtime-api Version ^2.0
guzzlehttp/guzzle Version ^7.15.2
guzzlehttp/psr7 Version ^2.7
psr/http-client Version ^1.0
psr/http-message Version ^1.1 || ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package html-css-to-image/client contains the following files

Loading the files please wait ...