# webmozarts/assert

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

Repository: https://github.com/webmozarts/assert
Canonical: https://ross.abutalabs.com/products/assert
Language: PHP
License: MIT
License Family: permissive
Last push: 2026-06-15T15:32:30+00:00

## Health v2 (maintenance only)
Score: 90/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 87, release rhythm 89, longevity 100
- inputs: {"age_days": 4193, "days_push": 79, "days_rel": 79, "gap_med": 8, "n_releases_24m": 12}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 7651, forks 164 (observed 2026-08-28T04:10:02.195309+00:00)

## What it is
A PHP library providing efficient assertions for validating method input and output, throwing InvalidArgumentException with clear, consistently formatted error messages on failure. It is a popular Composer package inspired by beberlei/assert with improved error message usability.

## Use cases
- validate method arguments in php
- assert value is a string or integer
- throw exceptions with nice error messages
- defensive programming input checks
- validate constructor parameters
- replace manual type checks with assertions

## When to choose
- you need lightweight input validation in PHP with readable error messages
- you want consistent sprintf placeholder ordering in assertion messages
- you prefer a small dependency over a full validation framework

## When to avoid
- you need complex rule-based or schema validation
- you want assertions that fail softly instead of throwing exceptions
- you are not working in PHP

## Facets
- artifact type: library
- maturity: stable
- function: error-handling, developer-tools
- domain: developer-tools, programming-languages
- platform: php
- tags: input-validation, assertions, defensive-programming, composer-package

## Member repositories
- webmozarts/assert (main) score 90

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:10:02.195309+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:36:45.565628+00:00, confidence not recorded.
  - readme: https://github.com/webmozarts/assert (fetched 2026-08-28T04:10:02.195309+00:00, sha 605718999eb7)
- Data as of 2026-08-30T08:39:29.467469+00:00.
