Skip to content

Files

Latest commit

Feb 2, 2025
18b6846 · Feb 2, 2025

History

History
45 lines (32 loc) · 848 Bytes

README.md

File metadata and controls

45 lines (32 loc) · 848 Bytes

php-typst

PHP extension for compiling Typst documents

Development

Install deps

sudo apt install bison re2c llvm clang libclang-dev

Install deps and dev version of PHP

sudo apt install php-dev

OR

Build PHP from source at $HOME/build/php

git clone https://github.com/php/php-src.git
cd php-src
git checkout PHP-8.3
./buildconf
PREFIX="${HOME}/build/php"
./configure --prefix="${PREFIX}" --enable-debug --disable-all --disable-cgi
make -j "$(nproc)"
make install

Build extension via Cargo

# Specify paths to PHP and PHP_CONFIG
PHP=$PREFIX/bin/php PHP_CONFIG=$PREFIX/bin/php-config cargo build
${PHP} -d extension=./php-typ/target/debug/libtyp_php.so ./test.php

Built on