PHPackages                             hanhan1978/ffi-sdl3 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. hanhan1978/ffi-sdl3

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

hanhan1978/ffi-sdl3
===================

PHP FFI bindings for SDL3 and SDL3\_ttf

v0.1.3(2mo ago)04Apache-2.0PHPPHP &gt;=8.4

Since Apr 16Pushed 2mo agoCompare

[ Source](https://github.com/hanhan1978/ffi-sdl3)[ Packagist](https://packagist.org/packages/hanhan1978/ffi-sdl3)[ Docs](https://github.com/hanhan1978/ffi-sdl3)[ RSS](/packages/hanhan1978-ffi-sdl3/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (5)Used By (0)

hanhan1978/ffi-sdl3
===================

[](#hanhan1978ffi-sdl3)

Small PHP FFI bindings for SDL3 and SDL3\_ttf.

This package was split out from the overlay demo so it can be reused as an independent Composer library.

Requirements
------------

[](#requirements)

- PHP 8.4 or later
- `ext-ffi`
- SDL3
- SDL3\_ttf
- Apache-2.0 license

Installation
------------

[](#installation)

```
composer require hanhan1978/ffi-sdl3:^0.1
```

Local development
-----------------

[](#local-development)

If you are developing against a local checkout, add a path repository to the parent project's `composer.json` and run `composer install`.

```
{
  "repositories": [
    {
      "type": "path",
      "url": "../ffi-sdl3"
    }
  ]
}
```

Usage
-----

[](#usage)

```
use SDL3\BlendMode;
use SDL3\Color;
use SDL3\SDL;
use SDL3\TTF\Font;
use SDL3\TTF\TTF;
use SDL3\Window;
use SDL3\WindowFlag;

$sdl = SDL::init();
$ttf = TTF::init($sdl);
$font = new Font($ttf, '/System/Library/Fonts/Helvetica.ttc', 32.0);

$window = new Window($sdl, 'Overlay', 640, 80, [
    WindowFlag::Borderless,
    WindowFlag::AlwaysOnTop,
    WindowFlag::Transparent,
]);

$renderer = $window->createRenderer();
$renderer->setDrawBlendMode(BlendMode::Blend);

$surface = $font->renderTextBlended('Hello', new Color(255, 230, 80));
$texture = $renderer->createTextureFromSurface($surface);
$surface->destroy();
```

Library lookup
--------------

[](#library-lookup)

`LibraryFinder` searches for SDL3 and SDL3\_ttf in this order:

- `SDL3_LIBRARY_PATH`
- `SDL3_TTF_LIBRARY_PATH`
- `pkg-config`
- Common Homebrew paths

Public API
----------

[](#public-api)

- `SDL3\SDL`
- `SDL3\Window`
- `SDL3\Renderer`
- `SDL3\Texture`
- `SDL3\Surface`
- `SDL3\Rect`
- `SDL3\Color`
- `SDL3\WindowFlag`
- `SDL3\BlendMode`
- `SDL3\Event\*`
- `SDL3\TTF\TTF`
- `SDL3\TTF\Font`

License
-------

[](#license)

Apache-2.0

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance86

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~8 days

Total

4

Last Release

74d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f3d0cc4739acf99b1c6d0c5b9d536b3d950f1e1d9ea304b91cd26a379e5ed281?d=identicon)[hanhan1978](/maintainers/hanhan1978)

---

Top Contributors

[![hanhan1978](https://avatars.githubusercontent.com/u/491838?v=4)](https://github.com/hanhan1978 "hanhan1978 (7 commits)")

---

Tags

phpffittfmacossdlsdl3

### Embed Badge

![Health badge](/badges/hanhan1978-ffi-sdl3/health.svg)

```
[![Health](https://phpackages.com/badges/hanhan1978-ffi-sdl3/health.svg)](https://phpackages.com/packages/hanhan1978-ffi-sdl3)
```

###  Alternatives

[sj-i/php-fuse

PHP FFI bindings for FUSE

641.7k2](/packages/sj-i-php-fuse)[serafim/ffi-sdl

SDL FFI bindings for the PHP language

324.6k3](/packages/serafim-ffi-sdl)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
