PHPackages                             boesing/psalm-plugin-stringf - 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. boesing/psalm-plugin-stringf

ActivePsalm-plugin

boesing/psalm-plugin-stringf
============================

Psalm plugin to work with `sprintf`, `printf`, `sscanf` and `fscanf`.

1.4.0(3y ago)12197.7k↓22.4%1[6 issues](https://github.com/boesing/psalm-plugin-stringf/issues)[10 PRs](https://github.com/boesing/psalm-plugin-stringf/pulls)7BSD-3-ClausePHPPHP ^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0

Since Aug 8Pushed 2y ago1 watchersCompare

[ Source](https://github.com/boesing/psalm-plugin-stringf)[ Packagist](https://packagist.org/packages/boesing/psalm-plugin-stringf)[ Fund](https://funding.communitybridge.org/projects/laminas-project)[ RSS](/packages/boesing-psalm-plugin-stringf/feed)WikiDiscussions 1.5.x Synced 1mo ago

READMEChangelog (5)Dependencies (10)Versions (22)Used By (7)

Psalm Plugin Stringf
====================

[](#psalm-plugin-stringf)

[![Build Status](https://github.com/boesing/psalm-plugin-stringf/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/boesing/psalm-plugin-stringf/actions/workflows/continuous-integration.yml)

This plugin provides additional checks to the built-in `sprintf`, `printf`, `sscanf` and `fscanf` function usage.

Installation
------------

[](#installation)

### Require composer dev-dependency

[](#require-composer-dev-dependency)

```
composer require --dev boesing/psalm-plugin-stringf

```

### Run Psalm-Plugin Binary

[](#run-psalm-plugin-binary)

```
vendor/bin/psalm-plugin enable boesing/psalm-plugin-stringf

```

Features
--------

[](#features)

- Parses `sprintf` and `printf` arguments to verify if the number of passed arguments matches the amount of specifiers
- Verifies if the return value of `sprintf` might be a `non-empty-string`
- Verifies possibly invalid argument of `sprintf` and `printf` ([experimental](#report-possibly-invalid-argument-for-specifier))
- Verifies unnecessary function calls of `sprintf` and `printf` ([experimental](#report-unnecessary-function-calls))

Experimental
------------

[](#experimental)

This plugin also provides experimental features.

Experimental features can be enabled by extending the plugin configuration as follows:

```

```

### Report Possibly Invalid Argument for Specifier

[](#report-possibly-invalid-argument-for-specifier)

```

```

The `ReportPossiblyInvalidArgumentForSpecifier` experimental feature will report `PossiblyInvalidArgument` errors for arguments used with `sprintf` or `printf`. Here are some examples:

```
printf('%s', 1);
```

```
PossiblyInvalidArgument: Argument 1 inferred as "int" does not match (any of) the suggested type(s) "string"

```

```
printf('%d', 'foo');
```

```
PossiblyInvalidArgument: Argument 1 inferred as "string" does not match (any of) the suggested type(s) "float\|int\|numeric-string"

```

### Report Unnecessary Function Calls

[](#report-unnecessary-function-calls)

```

```

The `ReportUnnecessaryFunctionCalls` experimental feature will report `UnnecessaryFunctionCall` errors for function calls to `sprintf` or `printf` which can be omitted. Here are some examples:

```
printf('Some text without any placeholder');
sprintf('Some text without any placeholder');
```

```
UnnecessaryFunctionCall: Function call is unnecessary as there is no placeholder within the template.

```

Release Versioning Disclaimer
-----------------------------

[](#release-versioning-disclaimer)

This plugin won't follow semantic versioning even tho the version numbers state to be semantic versioning compliant. The source code of this plugin is not meant to used like library code and therefore **MUST** be treated as internal code.

- This package will raise dependency requirements whenever necessary.
- If there is a new major version of psalm, this plugin **MAY** migrate to that version but won't be early adopter.
- If there is a new PHP minor/major version which is not supported by this library, this library **MAY** migrate to that version but won't be early adopter.

So to summarize: If your project depends on the latest shiny versions of either Psalm or PHP, this plugin is not for you. If you can live with that, feel free to install. Demands in any way will be either ignored or handled whenever I feel I want to spend time on it.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 54.7% 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.

###  Release Activity

Cadence

Every ~64 days

Total

11

Last Release

1106d ago

PHP version history (3 changes)1.0.0PHP ^7.4 || ~8.0.0

1.1.0PHP ^7.4 || ~8.0.0 || ~8.1.0

1.4.0PHP ^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/bb2738b201c0f9c9eb9a0682e72329fca6d2b8b1cf65402ed490a1e716879885?d=identicon)[boesing](/maintainers/boesing)

---

Top Contributors

[![boesing](https://avatars.githubusercontent.com/u/2189546?v=4)](https://github.com/boesing "boesing (140 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (116 commits)")

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/boesing-psalm-plugin-stringf/health.svg)

```
[![Health](https://phpackages.com/badges/boesing-psalm-plugin-stringf/health.svg)](https://phpackages.com/packages/boesing-psalm-plugin-stringf)
```

###  Alternatives

[veewee/xml

XML without worries

1835.9M29](/packages/veewee-xml)[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M82](/packages/symplify-monorepo-builder)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[laminas/laminas-cache

Caching implementation with a variety of storage options, as well as codified caching strategies for callbacks, classes, and output

1076.9M130](/packages/laminas-laminas-cache)[php-soap/wsdl-reader

A WSDL reader in PHP

212.3M9](/packages/php-soap-wsdl-reader)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)

PHPackages © 2026

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