yiisoft / yiisoft/validator

Make File size validation messages human-readable

Open
#802 0 comments 0 reactions 1 assignee View on GitHub

@samdark is already working on this.

Since Jun 4, 2026.

type:bug
Dominant language
PHP
Stars
167
Forks
47
Avg merge
1d 19h
Merged PRs (30d)
3

Description

Yiisoft\Validator\Rule\File size validation placeholders currently expose raw byte counts.

Example:

new File(
    maxSize: 50 * 1024 * 1024,
    tooBigMessage: "{file} is larger than {limit}.",
)

{limit} resolves to 52428800, which is not convenient for user-facing upload validation messages.

Preferred behavior: use the same existing placeholders, but format size values in a human-readable way:

  • {limit} -> 50 MB
  • {exactly} -> 50 MB

This would let applications use Yii Validator defaults/placeholders without duplicating byte-to-readable-size formatting in application code.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.