Skip to content
CAI
Software that uses CAICheck a score

KnpLabs/snappy

66.6

Adequate · 19 September 2026

1.2k

lines of production code

PHP

primary language

1

measurement over time

CAI band scale
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 watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 67.

Lenses

  • Code Health 95
  • Architecture 69
  • Maturity 54
  • Readiness 76
  • Security 100

Changes since last survey

  • 300 commits — 239 feature/other, 61 fixes

By area

  • (repo) — 110 commits
  • (root) — 87 commits
  • src/Knp — 57 commits
  • doc/faq.md — 23 commits
  • .github/workflows — 10 commits
  • test/Knp — 6 commits
  • tests/Knp — 6 commits
  • .github/stale.yml — 1 commit

Notable commits

  • fix: Apply fixes from StyleCI
  • fix: CS fixes
  • fix: Fix #121
  • fix: Fix CS
  • fix: Fix bad version number in changelog (v1.0.5 -> v1.1.0)
  • fix: Fix codestyle
  • fix: Fix debug function on null logger
  • fix: Fix documentation display PDF in the browser
  • fix: Fix isFileHeader/isFileFooter Params
  • fix: Fix issue with options
  • fix: Fix little issues in the FAQ
  • fix: Fix pdf options order
  • fix: Fix readme
  • fix: Fix readme
  • fix: Fix wrong documentation
  • fix: Fixed docblocks
  • fix: Merge pull request #117 from nullziu/temporary-file-url-cleanup-fix
  • fix: Merge pull request #143 from craue/fix-empty-env-argument
  • fix: Merge pull request #176 from KnpLabs/fix/autoloading
  • fix: Merge pull request #181 from craue/fix-tests-windows
  • …and 280 more

Written by watchdog.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 19 September 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.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.