PHPackages                             jrglasgow/c2patool - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. jrglasgow/c2patool

ActiveLibrary[CLI &amp; Console](/categories/cli)

jrglasgow/c2patool
==================

PHP Wrapper for the c2patool command line utility found at https://github.com/contentauth/c2patool

0.5.2(2mo ago)01.5kGPL-2.0-or-laterPHP

Since Jan 30Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/jrglasgow/c2patool)[ Packagist](https://packagist.org/packages/jrglasgow/c2patool)[ RSS](/packages/jrglasgow-c2patool/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (26)Used By (0)

C2PATool
========

[](#c2patool)

Introduction
============

[](#introduction)

This is a PHP wrapper for the [c2patool command line binary](https://github.com/contentauth/c2patool) provided by the [Content Authenticity Initiative](https://contentauthenticity.org/). The intent is to make it easier to add signed manifests to media assets as well as reading/validating those signed manifests.

Usage
=====

[](#usage)

The Tool class
--------------

[](#the-tool-class)

The tool class is the actual wrapper would the c2patool excutable. This Class will pass commands off to the exceutable and return any output.

### Creating the Tool

[](#creating-the-tool)

```
$tool = new \Jrglasgow\C2paTool\Tool(Psr\Log\LoggerInterface $logger);

```

By default the Tool constructor will search the `$PATH` for the c2patool executable. If it can be found it will be used...if you wish for a different version of the utility to be used you can specify

```
$tool->setBinary('/path/to/bin/c2patool');

```

The Signer class
----------------

[](#the-signer-class)

The Signer class will handle all things certificate and will sign the media asset manifests.

### Validating the cert can be used for Content Authenticity

[](#validating-the-cert-can-be-used-for-content-authenticity)

You can validate that the certificate can be used for Content Credential signing by passing the certificate/key locations into the Signer::validateCert() method. If you pass in a stdClass object information about the certificate will be placed in the object for later use. Certificate MUST follow the specification in the [Content Authenticity Initiative documentation for Signing Manifests](https://opensource.contentauthenticity.org/docs/manifest/signing-manifests/#certificates).

```
$is_valid = \Jrglasgow\c2patool\Signer::validateCert($cert_file_path, $key_file_path, $cert_file);

```

If `$cert_file_path = 'ENVIRONMENT_VARIABLE';` and `$key_file_path = ''ENVIRONMENT_VARIABLE';` then instead of looking for the key and cert files on the file shystem the environment variables C2PA\_PRIVATE\_KEY and C2PA\_SIGN\_CERT variables will be used instead as [allowed in the c2patool documentation](https://github.com/contentauth/c2patool/blob/main/docs/x_509.md).

### Creating a new Signer

[](#creating-a-new-signer)

As with certificate validation if `$cert_file_path = 'ENVIRONMENT_VARIABLE';` and `$key_file_path = ''ENVIRONMENT_VARIABLE';` then instead of looking for the key and cert files on the file shystem the environment variables C2PA\_PRIVATE\_KEY and C2PA\_SIGN\_CERT variables will be used instead as [allowed in the c2patool documentation](https://github.com/contentauth/c2patool/blob/main/docs/x_509.md).

```
$signer = new Jrglasgow\C2paToolSigner($tool, $cert_file_path, $key_file_path);

```

### Signing and embedding a manifest

[](#signing-and-embedding-a-manifest)

#### Creating a Manifest

[](#creating-a-manifest)

Create your manifest as a JSON string or an Array using the [examples](https://opensource.contentauthenticity.org/docs/manifest/manifest-examples/) as a reference. The manifest will be modified and converted to a string afterwards.. The signature algorithm (alg), Private Key (private\_key) and Sign Certificate (sign\_cert) need not be included as they will be replaced with the information from the certificate when creating the Signer object. If the Claim Generator (claim\_generator) is left empty one will be inserted automatically. Likewise if the Time Authority (ta\_url) is left empty one will be inserted as well.

### Invoke the sign method

[](#invoke-the-sign-method)

```
$success = $signer->sign($source_file, $destination_file, $manifest);

```

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance84

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~31 days

Recently: every ~67 days

Total

25

Last Release

86d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1824713?v=4)[James R Glasgow](/maintainers/jrglasgow)[@jrglasgow](https://github.com/jrglasgow)

---

Top Contributors

[![jrglasgow](https://avatars.githubusercontent.com/u/1824713?v=4)](https://github.com/jrglasgow "jrglasgow (1 commits)")

---

Tags

c2paphp

### Embed Badge

![Health badge](/badges/jrglasgow-c2patool/health.svg)

```
[![Health](https://phpackages.com/badges/jrglasgow-c2patool/health.svg)](https://phpackages.com/packages/jrglasgow-c2patool)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[humbug/box

Fast, zero config application bundler with PHARs.

1.3k801.5k68](/packages/humbug-box)[magento/community-edition

Magento 2 (Open Source)

12.1k52.1k10](/packages/magento-community-edition)[crunzphp/crunz

Schedule your tasks right from the code.

2292.0M6](/packages/crunzphp-crunz)[wheelpros/fitment-platform-api

Magento 2 (Open Source)

12.1k1.2k](/packages/wheelpros-fitment-platform-api)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k17](/packages/civicrm-civicrm-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
