Skip to content
CAI
Software that uses CAICheck a score

sebastianbergmann/php-text-template

69.2

Adequate · 19 September 2026

542

lines of production code

PHP

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is a PHP library providing a simple template engine that loads files and performs string substitution using configurable delimiters. It includes custom exception classes for error handling and is supported by a comprehensive test suite and static analysis tooling. The project maintains a standard PHPUnit structure with automated release note extraction capabilities.

Features

Add Template class for simple string substitution

Introduces a new \Template\ class in \src/Template.php\ that loads a template file (or its \.dist\ fallback) and performs simple string replacement using configurable open and close delimiters. Users can set variables via \setVar()\ and render the result as a string or write it directly to a target file via \renderTo()\.

src · high confidence

Add custom exception classes for the template library

The library now includes a dedicated set of exception classes within the \SebastianBergmann\\Template\ namespace. A new \Exception\ interface extends \Throwable\, serving as the base for specific error types: \InvalidArgumentException\ and \RuntimeException\. This allows consumers to catch template-specific errors distinctly from general PHP exceptions.

src/exceptions · high confidence

Initial project structure and tooling configuration

The repository has been initialized with a standard PHPUnit project structure, including source and test directories, a BSD 3-Clause license, and a CHANGELOG documenting versions from 1.0.0 through 6.0.0. Development tooling is configured via PHP-CS-Fixer, PHPUnit, and PHPStan (level 10), with build automation managed by Ant and dependency updates handled by Renovate. The project has officially dropped support for PEAR in favor of Composer, removing legacy package.xml and README.markdown files, and establishes a security policy aligned with PHPUnit.

(repo-wide) · high confidence

New script to extract release notes from changelog

A new PHP script, \build/scripts/extract-release-notes.php\, has been added to the build tooling. This utility reads the \ChangeLog.md\ file and extracts the section corresponding to a specific version tag provided as an argument, outputting the release notes for that version. This supports the automated release process by providing a programmatic way to retrieve changelog entries for tagged releases.

build · high confidence

Removals

Removal of legacy Text\_Template class

The legacy Text\_Template class has been removed from the codebase. This class previously provided a simple template engine that loaded templates from files, allowed setting variables via setVar, and rendered output using simple {variable} placeholders. Users relying on this specific class for template processing will need to migrate to an alternative solution.

Text · high confidence

Behavioural changes

126 commits (0 fixes) modifying tools

A change to existing behaviour in tools — 126 commits, 4 files.

tools · medium confidence · unverified

Test coverage

Added unit tests for the Template class

Added a new test suite (TemplateTest) that verifies the Template class can render variables from template files, merge multiple variable sets, and correctly throws an exception when a non-existent template is requested. The test suite uses PHPUnit attributes and includes the necessary fixture files.

tests · high confidence

Dependencies

Update development dependencies to PHPUnit 13 and PHPStan 2

The project's \composer.json\ now requires PHP 8.4 and updates the development dependency \phpunit/phpunit\ to version ^13.3.4. Additionally, the PHPStan tooling in \tools/.phpstan/composer.json\ has been upgraded to PHPStan ^2.2.14, along with its extensions \phpstan-strict-rules\ (^2.0.12) and \ergebnis/phpstan-rules\ (^2.13.1).

(dependencies) · high confidence

Updated PHPStan static analysis tooling to version 2.2.14

The \tools/.phpstan\ directory has been updated to use PHPStan version 2.2.14, along with \phpstan-strict-rules\ 2.0.12 and \ergebnis/phpstan-rules\ 2.13.1. This upgrade brings the latest static analysis capabilities and rule sets to the project's local development environment, ensuring that code quality checks reflect the most recent standards and bug fixes provided by these libraries.

tools/.phpstan · 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 69.

Lenses

  • Code Health 100
  • Architecture 69
  • Maturity 61
  • Readiness 78
  • Security 88

Changes since last survey

  • 300 commits — 295 feature/other, 5 fixes

By area

  • .phive/phars.xml — 95 commits
  • (root) — 71 commits
  • .github/workflows — 55 commits
  • tools/.phpstan — 42 commits
  • (repo) — 20 commits
  • src/Template.php — 7 commits
  • .psalm/baseline.xml — 4 commits
  • .github/FUNDING.yml — 2 commits
  • .psalm/config.xml — 2 commits
  • .github/CODE_OF_CONDUCT.md — 1 commit
  • tests/TemplateTest.php — 1 commit

Notable commits

  • fix: Fix CS/WS issues
  • fix: Fix CS/WS issues
  • fix: Fix CS/WS issues
  • fix: Fix package name
  • fix: Fix/Tweak
  • change: * Install PHPStan using Composer in order to be able to use phpstan/phpstan-strict-rules and tomasvotruba/type-coverage * Configure phpstan/phpstan-strict-rules, tomasvotruba/type-coverage, and ergebnis/phpstan-rules * Update PHPStan configuration * Put Phive binary under version control and manage it through "ant update-tools"
  • change: Add Liberapay and Tidelift
  • change: Add Security Policy
  • change: Add badges
  • change: Add link to security policy
  • change: Add thanks.dev
  • change: Allow write operations
  • change: Also automerge minor updates
  • change: Bump
  • change: Bump
  • change: Bump copyright year
  • change: Bump copyright year
  • change: Bump copyright year
  • change: Bump copyright year
  • change: Bump copyright year
  • …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

sebastianbergmann/php-text-template 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 8a1ca27077244715d05faa4a48723453bd812131 — 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.