Make File size validation messages human-readable
Open
@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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.