Skip to content

Packages

phpdftk is a monorepo with 30 packages. Each has its own Composer name, PSR-4 namespace, and can be installed independently.

filesystem (local-file I/O guard)
|
v (used by all packages that read or write disk)
geometry, color, filters, encoding, font-metrics,
font-parser, image-metadata, xml, xmp, crypt
|
v (depended on by)
pdf-core
|
+-- pdf-writer (Level 1 + Level 2 APIs)
+-- pdf-reader (parser + text extraction)
+-- pdf-toolkit (reader-to-writer pipelines)
+-- pdf-conformance (ISO standard validation; also depends on xmp)
text, css (depended on by)
|
v
html, svg, mathml (typed-tree parsers)
|
v
html-to-pdf (uses css + text + html + svg + mathml + resource-loader
+ paged-media + raster + barcode)
svg-to-pdf (uses css + text + svg + resource-loader)
mathml-to-pdf (uses css + text + mathml + font-parser; consumed by
html-to-pdf via the inline-MathML adapter)

filesystem is the only package allowed to call PHP’s raw filesystem primitives (fopen, file_get_contents, etc.). Every other package that touches a local path goes through Phpdftk\Filesystem\LocalFilesystem, which rejects stream-wrapper paths (php://, http://, phar://, …) and normalises error reporting.

pdf-writer and pdf-reader never depend on each other. pdf-toolkit depends on pdf-core and pdf-reader but not pdf-writer. pdf-conformance depends on pdf-core and xmp.

The rendering packages (html-to-pdf / svg-to-pdf / mathml-to-pdf) emit PDF via pdf-writer but never call into the parsers directly — every cross-package handoff is typed (Phpdftk\Html\Dom\Document, Phpdftk\Svg\SvgDocument, Phpdftk\Mathml\MathmlDocument).

PackageComposerNamespacePurpose
pdf/allphpdftk/pdfMetapackage: installs core + writer + reader
pdf/corephpdftk/pdf-corePhpdftk\Pdf\Core\Object model + file serialization
pdf/writerphpdftk/pdf-writerPhpdftk\Pdf\Writer\Level 1 (PdfWriter) + Level 2 (Pdf) APIs
pdf/readerphpdftk/pdf-readerPhpdftk\Pdf\Reader\PDF parser with text extraction
pdf/toolkitphpdftk/pdf-toolkitPhpdftk\Pdf\Toolkit\High-level manipulation pipelines
pdf/conformancephpdftk/pdf-conformancePhpdftk\Pdf\Conformance\ISO standard validation (PDF/A, PDF/X, PDF/UA, PDF/VT, PDF/E, PDF/R, ZUGFeRD, PDF/mail)

These ship the HTML/CSS, SVG, and MathML pipelines that produce vector PDF output. Each has dedicated documentation under Rendering.

PackageComposerNamespacePurpose
htmlphpdftk/htmlPhpdftk\Html\WHATWG HTML5 parser + DOM + declarative Shadow DOM (detail)
cssphpdftk/cssPhpdftk\Css\CSS Syntax 3 + Values 4 + Selectors 4 + Cascade 5 (detail)
svgphpdftk/svgPhpdftk\Svg\SVG 2 parser producing a typed tree (detail)
mathmlphpdftk/mathmlPhpdftk\Mathml\MathML Core parser producing a typed tree (detail)
textphpdftk/textPhpdftk\Text\UAX #14 line breaking, UAX #9 bidi, OpenType GSUB/GPOS shaping (detail)
html-to-pdfphpdftk/html-to-pdfPhpdftk\HtmlToPdf\HTML + CSS → PDF translator (detail)
svg-to-pdfphpdftk/svg-to-pdfPhpdftk\SvgToPdf\SVG → PDF translator (detail)
mathml-to-pdfphpdftk/mathml-to-pdfPhpdftk\MathmlToPdf\MathML → PDF translator (consumed by html-to-pdf for inline math)
paged-mediaphpdftk/paged-mediaPhpdftk\PagedMedia\CSS Paged Media 3 + Fragmentation 4 substrate (@page, named pages, margin boxes, break-* properties)
rasterphpdftk/rasterPhpdftk\Raster\Raster compositor for blur, filter primitives, and shadow halos (Phase 4C)
resource-loaderphpdftk/resource-loaderPhpdftk\ResourceLoader\HTTP + file fetcher with SSRF gates, MIME sniffing, and content caching
barcodephpdftk/barcodePhpdftk\Barcode\Barcode / QR code rendering for <img> and CSS background-image data-URIs
wpt-harnessphpdftk/wpt-harnessPhpdftk\WptHarness\Web Platform Tests runner, manifest, and cross-browser oracle

These have zero PDF dependencies and can be used standalone in any PHP project:

PackageComposerNamespacePurpose
geometryphpdftk/geometryPhpdftk\Geometry\Rectangle, Matrix, PageSize, BezierCurve
colorphpdftk/colorPhpdftk\Color\RGB, CMYK, Gray with conversions
filtersphpdftk/filtersPhpdftk\Filters\FlateDecode, ASCII85, ASCIIHex, RunLength, LZW, CCITTFax, JBIG2, Predictor
encodingphpdftk/encodingPhpdftk\Encoding\WinAnsi, MacRoman, Adobe Glyph List, CMap parser
filesystemphpdftk/filesystemPhpdftk\Filesystem\Local-file I/O wrapper that rejects stream wrappers (php://, http://, …) — every package that touches the disk routes through this
font-metricsphpdftk/font-metricsPhpdftk\FontMetrics\AFM data for all 14 standard PDF fonts
font-parserphpdftk/font-parserPhpdftk\FontParser\TrueType/OpenType parsing, subsetting, kerning, ligatures
image-metadataphpdftk/image-metadataPhpdftk\ImageMetadata\JPEG, PNG (RGB / RGBA / grayscale / 1-8 bit indexed), GIF, TIFF, WebP, SVG header parsing
xmlphpdftk/xmlPhpdftk\Xml\XML parser used by svg, mathml, and xmp
xmpphpdftk/xmpPhpdftk\Xmp\XMP metadata packet read/write
cryptphpdftk/cryptPhpdftk\Crypt\AES-128/256, RC4, PDF key derivation, PKCS#7