carthage-software / ext-typst-stubs
IDE and static analysis stubs for ext-typst, the Typst typesetting engine for PHP.
Package info
github.com/carthage-software/ext-typst-stubs
pkg:composer/carthage-software/ext-typst-stubs
Requires
- php: ~8.3.0 || ~8.4.0 || ~8.5.0
README
IDE and static-analysis stubs for ext-typst, the Typst typesetting engine for PHP.
Note
This repository is a mirror. Its contents are generated from the
stubs/
directory of carthage-software/ext-typst and pushed here automatically on
every change. Do not edit it directly; open PRs against
carthage-software/ext-typst.
Installation
composer require --dev carthage-software/ext-typst-stubs
Each tag matches the corresponding ext-typst release, so you can pin the
stubs to the extension version you target (e.g. ^0.2).
What this gives you
The stubs declare the Typst\* classes, interfaces, enums, and functions that
the compiled extension provides, so editors and analyzers understand the API
even on machines where the extension isn't installed.
-
PhpStorm and Mago: discover the stubs automatically (they index
vendor/). -
PHPStan: add the stub directory to your
phpstan.neon:parameters: scanDirectories: - vendor/carthage-software/ext-typst-stubs/stubs
-
Psalm: reference the stubs in your
psalm.xml:<stubs> <file name="vendor/carthage-software/ext-typst-stubs/stubs/Typst" /> </stubs>
The class stubs are PSR-4 autoloadable. When the extension is loaded, the
autoloader is never consulted for Typst\* (the real classes already exist).
When it isn't, calling any stub method throws an Error explaining that the
extension must be installed; so a missing extension fails loudly instead of
silently.
License
MIT OR Apache-2.0