Installation

Learn how to install and render your first HTML content.

Installation

To install typeset.sh in your PHP project, you have two options: using the PHAR file or Composer. We generally recommend using Composer.

Please note that an active subscription license is required for your project in order to install typeset.sh as described below.

Using phar file

  1. Sign up and purchase a license.

  2. Download the PHAR file from your project page.

  3. Include the PHAR file in your PHP script by adding it to your code.

  4. You can then access any typeset.sh functions and classes.

<?php

require_once 'typeset.sh.lib.phar';

Using composer access

To add the repository to your project, run the following command in your Composer project, this will add packages.typeset.sh to your composer.json file.

composer config repositories.typesetsh composer https://packages.typeset.sh

Next, you need to configure Composer to authenticate using your project ID and a token. You can create multiple tokens for different developers or deployment setups if needed. To generate a new token, go to your project page and find the "Create new tokens" option.

Add the token to your global Composer configuration using the command bellow:

composer config -g http-basic.packages.typeset.sh "{PUBLIC_ID}" "{TOKEN}"

Please note that the project API secret is not the same as the composer token. To create composer tokens, an active subscription license is required.

Require the typesetsh library by running the following command:

composer require typesetsh/typesetsh

Alternatively, you can use the Symfony bundle or Laravel wrapper, which come with helper functions and services for rendering templates. To use these instead of the typesetsh library, require the Laravel wrapper or Symfony bundle instead:

composer require typesetsh/laravel-wrapper
composer require typesetsh/pdf-bundle

Minimum requirements

Make sure your target environment is running PHP 7.4 or higher and has the PHAR extension installed. The following extensions are also required:

  • ext-curl

  • ext-dom

  • ext-exif

  • ext-fileinfo

  • ext-gd

  • ext-iconv

  • ext-libxml

  • ext-simplexml

  • ext-zlib

PHP 7.4 has reached the end of its lifecycle and we strongly recommend that all users upgrade to the latest version of PHP as soon as they can. However, we understand that this may not always be feasible and will continue to offer support for PHP 7.4 in the meantime.

Large PNG files can significantly slow down rendering in typeset.sh due to the slow image byte level decoding involved. To overcome this, consider installing the PHP extension Imagick or opting for file formats like JPEG or PDF.

The test pipeline runs on PHP 7.4, 8.0, 8.1, 8.2 and 8.3

Last updated