yolow92 / pagesift
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.
Requires
- php: >=8.1
- ext-ffi: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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
- The environment variable
PAGESIFT_LIB(full path to the library file). - 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.