Download the PHP package php-sdl/sdl3-ttf without Composer

On this page you can find all versions of the php package php-sdl/sdl3-ttf. 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 sdl3-ttf

php-sdl3-ttf

CI PHP SDL3 SDL3_ttf Built with Zephir

PHP extension for SDL3_ttf — TrueType font rendering built with Zephir.

sdl3ttf wraps SDL3_ttf for PHP 8.2+, giving you hardware-quality TrueType and OpenType font rendering from plain PHP scripts. It links against the system libSDL3 and libSDL3_ttf, so glyph rasterisation is as fast as a native C program.

Pair it with php-sdl/sdl3 for windowing, rendering, and event handling — both extensions share the Sdl3* top-level namespace and can be loaded side-by-side.


Table of contents


Requirements

Component Minimum version Notes
PHP 8.2 ZTS and NTS builds both supported.
php-sdl/sdl3 any Required. Provides the SDL3 window, renderer, and surface types this extension works with.
SDL3 3.4.0 C library — must be discoverable via pkg-config sdl3.
SDL3_ttf 3.2 C library — must be discoverable via pkg-config SDL3_ttf (or sdl3-ttf / sdl3_ttf).
OS Linux / macOS Windows is not currently supported.
Compiler C11 toolchain gcc, clang, or Apple Clang.
php-dev / phpize matches PHP Required for any build path.

Tested on macOS (Apple Silicon + Intel), Debian Trixie, Raspberry Pi OS (arm64 / armhf), and NVIDIA JetPack 6 (Jetson Orin).


Installation

Via PHP PIE (recommended)

Install php-sdl/sdl3 first (required), then install this extension:

PIE handles the full build pipeline (phpize → configure → make → install) automatically. Make sure SDL3 ≥ 3.4.0 and SDL3_ttf ≥ 3.2 are already installed on the system before running — use the platform scripts below if they are not.

Platform installers

Three installer scripts live at the repository root. Each one installs SDL3 and SDL3_ttf if they are missing, builds the extension with Zephir, and enables it for every detected PHP SAPI.

macOS (Homebrew):

Debian Trixie / Raspberry Pi OS (amd64, arm64, armhf):

JetPack 6 / Ubuntu 22.04 (builds SDL3 + SDL3_ttf from source):

Each script writes a full build log to ./build.log and prints concise failure diagnostics if anything goes wrong.

Manual build with phpize

If the generated C source exists in ext/, you can build without Zephir:

Then enable the extension:

If SDL3 or SDL3_ttf is installed in a non-standard prefix, export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig before ./configure.


Verifying the install

Run the bundled proof-of-work script — it opens a system font, renders text to a surface, and reports dimensions. No display server required.

Expected output:

A one-liner sanity check:


Quick start

To draw the rendered surface on screen, pass $surface['ptr'] to the php-sdl/sdl3 renderer via SDLRender::SDLCreateTextureFromSurface().


API reference

All methods live on a single static class:

Sdl3ttf\SDLTTF\SDLTTF

Lifecycle

Method Returns Description
TTFInit() bool Initialise SDL3_ttf. Call once.
TTFQuit() void Shut down SDL3_ttf.

Font loading

Method Returns Description
TTFOpenFont(string $file, float $size) array Open a .ttf / .otf file at the given point size.
TTFCloseFont(int $ptr) void Close a font previously opened with TTFOpenFont.

TTFOpenFont returns an associative array with font metadata:

Returns [] on failure.

Text rendering

Method Returns Description
TTFRenderTextBlended(int $font, string $text, int $r, int $g, int $b, int $a, int $length = 0) array Render UTF-8 text to an ARGB SDL_Surface with alpha blending.

$font is the ptr value from TTFOpenFont. $r/$g/$b/$a are 0-255 colour components. $length is the byte length of text to render (0 = use the full string).

Returns an associative array describing the surface:

Returns [] on failure.


Companion extension

This extension handles font rendering only. For windowing, input, rendering, and the rest of SDL3, install php-sdl/sdl3 alongside it.

Both extensions can be loaded simultaneously — they use separate PHP module names (sdl3 and sdl3ttf) and do not conflict.


License

MIT © Project Saturn Studios, LLC.


All versions of sdl3-ttf with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
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 php-sdl/sdl3-ttf contains the following files

Loading the files please wait ...