PHPackages                             setasign/setapdf-signer-x509-pdo-collection - 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. [Database &amp; ORM](/categories/database)
4. /
5. setasign/setapdf-signer-x509-pdo-collection

ActiveLibrary[Database &amp; ORM](/categories/database)

setasign/setapdf-signer-x509-pdo-collection
===========================================

A X509\\CollectionInterface implementation that uses PDO under the hood.

00PHP

Since May 12Pushed 4w agoCompare

[ Source](https://github.com/Setasign/SetaPDF-Signer-X509-PDO-Collection)[ Packagist](https://packagist.org/packages/setasign/setapdf-signer-x509-pdo-collection)[ RSS](/packages/setasign-setapdf-signer-x509-pdo-collection/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

`X509\PdoCollection` for the SetaPDF-Signer
===========================================

[](#x509pdocollection-for-the-setapdf-signer)

An example `X509\CollectionInterface` implementation that uses [`PDO`](https://www.php.net/manual/en/class.pdo.php)under the hood.

During the development two additional interfaces were implemented in SetaPDF and used in this project to get the best performance: `X509\Collection\FindBySubjectKeyIdentifierInterface`and `X509\Collection\FindByKeyHashInterface`.

This implementation shows how you can use a database as a source of e.g. trusted certificates for the `ValidationRelatedInfo\Collector` class.

For testing we use the certificate of the EUTL, Swiss Trust List and AATL. The trust lists are resolved by the [`setasign/trust-list-fetcher`](https://packagist.org/packages/setasign/trust-list-fetcher) project.

Please make sure, that you implement your own update mechanism to keep the list up-to-date!

The database table structure
----------------------------

[](#the-database-table-structure)

The implementation is technically independent to a database backend. It only requires a table with following columns, types and indexes:

ColumnTypeIndex / PKInfotlVersionvarchar(400)PK (tlVersion + digest)A trust list version identifiactiondigestchar(20)PK (tlVersion + digest)The hash (SHA-1) of the certificatekeyHashchar(20)IndexThe hash (SHA-1) of the public keysubjectvarchar(400)IndexLongest subject in the EUTL is actually 274 bytes long.issuervarchar(400)IndexLongest issuer in the EUTL is actually 244 bytes long.validFromuint(11)A unix timestampvalidTouint(11)A unix timestampserialNumbervarchar(42)Hexadecimal stringsubjectKeyIdentifiervarchar(64)IndexHexadecimal stringcertificatevarchar(6000)The PEM encoded certificate (Largest certificate in the EUTL is e.g. 4381 bytes).originvarchar(10)An unique identification of the origin.We use SQLite for testing purpose. You can find the script that creates the table [here](examples/create-tbl.php) and fills it with certificates of the EUTL.

Usage
-----

[](#usage)

Just create an instance of the `PdoCollection` class and pass it to e.g. the trusted certificates' collection:

```
$path = 'sqlite:path/to/db.sqlite';
$dbh  = new PDO($path);
$collection = new PdoCollection($dbh, '');

$collector = new ValidationRelatedInfo\Collector();
$collector->getTrustedCertificates()->add($collection);
// ...
```

Please note that this class is only an example implementation and we build it in the `setasign\SetaPDF2\Demos\Signer\X509\Collection` namespace to show that it is only a demonstration. You should create your own implementation in your own namespace.

How to run the examples
-----------------------

[](#how-to-run-the-examples)

For demonstration purpose we added demos, which rely on an SQLite database. You have to execute the script `/examples/create-tbl.php` to create the SQLite database in the `/assets` folder and import all certificates of the EUTL and AATL into it. The script will also write a timestamp into the file `/assets/version.data` which is later used by all examples as its trust list version identification.

Then you can simply execute any other script in the `/examples` folder.

What's the syntax of `subject` and `issuer`?
--------------------------------------------

[](#whats-the-syntax-of-subject-and-issuer)

As such collection instances are mostly used internally by the SetaPDF-Signer component, the subject and issuer strings are internally generated by the `DistinguishedName::getAsString()`method based on an underlying ASN.1 structure.

This method makes use of a static `DistinguishedName::$separator` property, which is used to separate the individual parts of the name. This static property has to be kept in sync with how the data were stored in the database.

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance62

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/78b46f7020bdcd25e761812659988691e50aba9a25b2a48ea33f6137f2fc2536?d=identicon)[Setasign](/maintainers/Setasign)

---

Top Contributors

[![JanSlabon](https://avatars.githubusercontent.com/u/12390057?v=4)](https://github.com/JanSlabon "JanSlabon (24 commits)")

### Embed Badge

![Health badge](/badges/setasign-setapdf-signer-x509-pdo-collection/health.svg)

```
[![Health](https://phpackages.com/badges/setasign-setapdf-signer-x509-pdo-collection/health.svg)](https://phpackages.com/packages/setasign-setapdf-signer-x509-pdo-collection)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k116.5M113](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8361.6M87](/packages/propel-propel1)[mpociot/laravel-composite-key

Support composite keys in your laravel app.

3544.8k1](/packages/mpociot-laravel-composite-key)

PHPackages © 2026

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