webmozarts/assert

Assertions to validate method input/output with nice error messages.

View on GitHub ↗Jump to charts ↓Open shareable report →

webmozarts/assert has 7.5k+ stars and 150+ forks on GitHub, is written in PHP, and was last pushed on Oct 5, 2026. Data as of . Signed-in members get hourly updates — create a free account.

Summary Information

Updated 55 minutes ago
Type:Library / SDKCategory(s):Core & Utility LibrariesLanguages & Runtimes
Added to GitGenius on September 8th, 2026
Created on March 11th, 2015
Open Issues & Pull Requests: 28 (+0)
GitHub issues: Enabled
Number of forks: 167
Total Stargazers: 7,649 (+0)
Total Subscribers: 30 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 38.1 days
Mean response time: 191.9 days
90th percentile: 449.5 days
Tracked items: 30

Maintainer activity

1 person did triage or write work on this repository in the last 12 months.

Counts unlabeled, assigned, unassigned, milestoned, demilestoned, locked, unlocked over the last 12 months. These are issue and pull request events that require triage or write permission. Commits and code review are not counted. labeled and renamed are excluded because GitHub issue forms record the issue author as the actor. Figures from October 11, 2026. This count is not comparable across projects: each project's automation decides which of these events a person emits. How this is counted.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 8
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 1,407 days
Stale 30+ days: 7
Stale 90+ days: 7

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • help wanted (8)
  • bug (6)
  • enhancement (5)
  • feature (3)
  • question (3)
  • symmetry (2)
  • invalid (1)

Most active issues this week

Sign in to see which issues are moving.
Sign in

Detailed Description

Webmozart Assert is a PHP library that provides assertions to validate method input and output with clear error messages.

The library solves the problem of writing repetitive validation code by offering a set of efficient assertions that throw InvalidArgumentException when they fail. Rather than manually checking conditions and constructing error messages throughout your codebase, you call assertion methods that handle both validation and messaging in a single step. The approach centers on consistent, readable error messages where placeholders follow a uniform pattern across all assertions: the first placeholder always represents the tested value, while subsequent numbered placeholders contain assertion-specific details like bounds or allowed values.

Developers should choose this tool when they want to reduce boilerplate validation code while maintaining clear, debuggable error messages. It suits any PHP project where method contracts need enforcement, from libraries to applications. The README explicitly compares it to beberlei/assert, noting that while both libraries serve similar purposes, Webmozart Assert addresses a usability issue with error message formatting. The key difference is consistent placeholder ordering: beberlei/assert varies the position of %s placeholders depending on the assertion type, whereas this library standardizes the pattern so %s always represents the tested value and additional placeholders follow predictably. This consistency makes it easier to write and understand custom error messages across different assertions.

The project maintains a steady stream of commits addressing bug fixes and minor improvements. Pull requests receive timely review and feedback from maintainers. Issues are actively triaged and responded to, with maintainers providing guidance on usage questions and evaluating feature requests against the library's scope. The codebase shows attention to code quality through consistent review practices.