Skip to content
CAI
Software that uses CAICheck a score

KnpLabs/snappy

67.5

Adequate · 17 November 2026

1.2k

lines of production code

PHP

primary language

5

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

KnpSnappy is a PHP library that generates PDFs and image snapshots from HTML content by wrapping the wkhtmltopdf and wkhtmltoimage executables. It provides a structured API for managing temporary files, executing processes via Symfony Process, and handling configuration options for various input sources. The system includes robust error handling, such as specific exceptions for file conflicts, and is supported by comprehensive unit tests and static analysis to ensure reliability.

Features

Initial release of KnpSnappy PDF and Image generation library

This change introduces the core KnpSnappy library, providing classes to generate PDFs and image snapshots from HTML content using wkhtmltopdf and wkhtmltoimage. The library includes an AbstractGenerator base class that manages temporary files, process execution via Symfony Process, and logging, along with specific Pdf and Image generators. Key features include support for multiple input sources (files, URLs, HTML strings), configurable options for both generators, timeout handling, and environment variable passing.

src/Knp/Snappy · high confidence

Project initialization and repository configuration

This change establishes the foundational structure for the Snappy PHP library by adding essential configuration and documentation files. It introduces coding standards enforcement via \.editorconfig\ and \php-cs-fixer\ configurations, sets up static analysis with \phpstan.neon\ (level 8), and configures the test suite with \phpunit.xml.dist\. The repository is further standardized with \.gitignore\ and \.gitattributes\ files, while the \README\ is updated to reflect current usage, including security warnings for \wkhtmltopdf\ and installation instructions for Symfony/Laravel integrations. Additionally, governance documents such as \SECURITY.md\, \CONTRIBUTING.md\, and \CODE\_OF\_CONDUCT.md\ are added to guide community interaction and vulnerability reporting.

(repo-wide) · high confidence

Removals

Removal of SnappyImage class

The \SnappyImage\ class has been removed from the codebase. This deletion eliminates the legacy functionality for generating image snapshots from URLs or file locations using the \wkhtmltoimage\ executable, meaning users can no longer use this specific class to create image outputs.

src · high confidence

Behavioural changes

Introduce FileAlreadyExistsException for clearer error handling

A new FileAlreadyExistsException class has been added to the Knp\\Snappy\\Exception namespace. This exception extends InvalidArgumentException and is designed to provide more explicit error reporting when attempting to generate a file that already exists in non-overwrite mode, replacing the previous generic exception usage.

src/Knp/Snappy/Exception · high confidence

Test coverage

Added unit tests for Knp Snappy generators

Added new test suites for the core Snappy components, including \AbstractGeneratorTest\, \ImageTest\, and \PdfTest\. These tests verify the behavior of option management (add/set), command generation, temporary file handling, and cleanup logic for PDF and image generation.

tests · high confidence

Dependencies

Updated dependencies and PHP version requirements

The library now requires PHP 8.1 or higher and has updated its core dependencies to support Symfony Process versions 5.0 through 8.0, as well as PSR Log versions 2.0 and 3.0. Development dependencies have also been updated, including PHPUnit to 9.6.29, PHPStan to 2.1.39, and PHP-CS-Fixer to 3.0.

(dependencies) · high confidence

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 67.5 → 67.5 (0.0)
  • Rubric changed (rubric-2026.11.2 → rubric-2026.11.4) — scores are not directly comparable.

Lenses

  • Code Health 97.2 → 96.7 (-0.5)
  • Architecture 69.0 → 69.0 (0.0)
  • Maturity 54.5 → 54.5 (0.0)
  • Readiness 81.8 → 81.8 (0.0)
  • Security 100.0 → 100.0 (0.0)

Resolved (1)

  • Off-boarding risk: anonymized user #1

New (2)

  • Edited copy of a member (10 corresponding lines) (src/Knp/Snappy/AbstractGenerator.php)
  • Off-boarding risk: anonymized user #1

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

KnpLabs/snappy was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 17 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit f749a7d2e0f1260f4a0f96925323e34ede898f1f — the exact code this score is about.
  • Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.85+preprod-eba6548ac50f.