The end goal of this project is to provide a PHP extension with bindings to the C2PA Rust SDK. I got started on this and was moved to a more expeditious project of a PHP Wrapper around the c2patool (command line binary).
I may have a chance to get back to this in the future.
C2PA::phpExtensionVersion()
will return the version of the PHP Extension
C2PA::rustLibraryVersion()
will return the version of the Rust library that is included in the PHP extension.
$c2pa = new C2PA()
cert_path = '/var/www/html/certs/es256_certs.pem';
$c2pa->setCertificate($cert_path);
$key_path = '/var/www/html/certs/es256_private.key';
$c2pa->setKey($key_path);
Follow the installation instruction at https://davidcole1340.github.io/ext-php-rs/getting-started/installation.html to install Rust and the PHP development environment.
Ensure that the following is installed:
- Rust/Cargo
- in Ubuntu
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- exit terminal and re-enter or reload your PATH to get the location of the binaries
- in Ubuntu
- php-dev/php-config
- in Ubuntu
sudo apt install php-dev
- in Ubuntu
- Clang
- in Ubuntu
sudo apt install clang -y
- in Ubuntu
- libclang
- in Ubuntu
sudo apt install libclang1 -y
- in Ubuntu