Search by

yolow92 / pagesift

yolow92

PHP (ext-ffi) binding of libpagesift: HTML, PDF, Office and other documents to Markdown and JSON. The native library is not bundled; install it from the GitHub Release.

v1.1.0 2026-11-04 08:46 UTC

This package is auto-updated.

Last update: 2026-11-04 08:59:23 UTC


README

A binding of pagesift using PHP's FFI extension. It needs PHP 8.1 or newer with ext-ffi, and ffi.enable=1 outside the CLI.

Install

composer require yolow92/pagesift

The package does not include the library. Download pagesift-ffi-<tag>-<target>.tar.gz from GitHub Releases (Linux x86_64, Linux aarch64, macOS arm64), or build it with cargo build --release -p pagesift-ffi.

Usage

use Pagesift\Pagesift;

$doc = Pagesift::convert('<h1>Hi</h1>');

Functions return the Document as a JSON string and do not parse it.

Finding the library

  1. The environment variable PAGESIFT_LIB (full path to the library file).
  2. The system library name (libpagesift.so, libpagesift.dylib).

Tests

From the repository root:

CARGO_TARGET_DIR=target/f cargo build --profile quick -p pagesift-ffi
./bindings/php/run_tests.sh

The tests do not use the network. Set PHP to choose the interpreter.

License

AGPL-3.0-only, with commercial licensing available. See the main repository.