Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Installation

ext-c2pa targets PHP 8.3+ (NTS and ZTS) on Linux and macOS. Windows is not supported.

Pre-built binaries

Every tagged release attaches pre-built extension tarballs to the GitHub Release, named with PIE’s filename convention per platform and PHP minor:

php_c2pa-v0.1.0_php8.5-arm64-darwin-bsdlibc-nts.tgz
php_c2pa-v0.1.0_php8.4-x86_64-linux-glibc-nts.tgz
php_c2pa-v0.1.0_php8.3-arm64-linux-glibc-nts.tgz

The recommended path is PIE, which picks the right tarball for your platform and PHP, verifies it, and wires up your php.ini:

pie install ericmann/ext-c2pa

Or manually: each tarball contains the compiled extension as c2pa.so (that exact name on macOS too — it’s PIE’s convention). Verify the .sha256 sidecar, unpack it somewhere your PHP can read, and point your php.ini at it:

extension=/path/to/c2pa.so

Verify:

$ php -m | grep c2pa
c2pa

Building from source

You need:

  • Rust (the pinned toolchain in rust-toolchain.toml is installed automatically by rustup)
  • PHP 8.3+ with php-config on your PATH (the php-dev/php-devel package on most Linux distributions)
  • Linux: build-essential libclang-dev — macOS: Xcode command-line tools

Then:

$ git clone https://github.com/ericmann/ext-c2pa
$ cd ext-c2pa
$ make build      # debug build → target/debug/libc2pa.{so,dylib}
$ make test       # PHPT suite against the just-built extension
$ make release    # optimized build → target/release/libc2pa.{so,dylib}

Load the built library the same way as above, or one-off on the CLI:

$ php -d extension=target/debug/libc2pa.dylib -r 'var_dump(extension_loaded("c2pa"));'
bool(true)

make help lists the other targets (clippy, fmt, stubs, install/uninstall via cargo-php, clean).

IDE stubs

stubs/c2pa.stubs.php mirrors the full PHP surface for IDEs and static analyzers (PHPStan, Psalm, IntelliSense). Point your tooling at it — the extension itself ships no PHP files.