PHPackages                             kkevindev/assert-return-value - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. kkevindev/assert-return-value

Abandoned → [webmozarts/assert](/?search=webmozarts%2Fassert)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

kkevindev/assert-return-value
=============================

A library that uses webmozarts/assert to assert and return the asserted value.

1.11.0.1(6mo ago)11.2k↓92.9%1MITPHPPHP ^8.1CI passing

Since Nov 15Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/kkevindev/assert-return-value)[ Packagist](https://packagist.org/packages/kkevindev/assert-return-value)[ RSS](/packages/kkevindev-assert-return-value/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (3)Versions (3)Used By (1)

Important

`webmozarts/assert` version 2.0 now finally supports return values! Use that package (again) instead. It should be a drop-in replacement (just update imports).

---

Assert Return Value (ARV)
=========================

[](#assert-return-value-arv)

[![Quality Assurance](https://github.com/kkevindev/assert-return-value/actions/workflows/quality_assurance.yaml.yml/badge.svg?branch=main)](https://github.com/kkevindev/assert-return-value/actions/workflows/quality_assurance.yaml.yml/badge.svg?branch=main)

This library uses `webmozart/assert` to assert values with the added benefit of returning the value.

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

[](#installation)

Use [Composer](https://getcomposer.org/) to install the package:

```
composer require kkevindev/assert-return-value
```

Versioning
----------

[](#versioning)

This libary follows the versioning of `webmozart/assert` with the addition of a patch version used for patching this library on the same `webmozart/assert` version.

`webmozart/assert``kkevindev/assert-return-value`Notes`1.11.0``1.11.0.0`Add support for `webmozart/assert:1.11.0``1.11.0``1.11.0.1`Fixed a bug in this package. Still only supports `webmozart/assert:1.11.0``1.11.0``1.11.0.2`Fixed a bug in this package. Still only supports `webmozart/assert:1.11.0``1.11.1``1.11.1.0`Add support for `webmozart/assert:1.11.1``1.12.0``1.12.0.0`Add support for `webmozart/assert:1.12.0``1.12.0``1.12.0.1`Fixed a bug in this package. Still only supports `webmozart/assert:1.12.0`Usage
-----

[](#usage)

Given the follwing code:

```
class User {
    public function __construct(
        public string $name,
        public string $email,
        public string $role,
    ) {
    }
}

class UserDto {
    public ?string $name = null;
    public ?string $email = null;
    public ?string $role = null;
}
```

This library allows you to write code like this:

```
use Webmozart\Assert\Assert as WebmozartAssert;
use Kkevindev\AssertReturnValue\Assert;

public function create(UserDto $userDto): User
{
    return new User(
       name: Assert::stringNotEmpty($userDto->name),
       email: Assert::stringNotEmpty($userDto->email),
       role: Assert::stringNotEmpty($userDto->role),
    );
}
```

Instead of:

```
use Webmozart\Assert\Assert as WebmozartAssert;
use Kkevindev\AssertReturnValue\Assert;

public function create(UserDto $userDto): User
{
    $name = $userDto->name;
    WebmozartAssert::stringNotEmpty($name);

    $email = $userDto->email;
    WebmozartAssert::stringNotEmpty($email);

    $role = $userDto->role;
    WebmozartAssert::stringNotEmpty($role);

    return new User(
        name: $name,
        email: $email,
        role: $role,
    );
}
```

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance69

Regular maintenance activity

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~49 days

Total

2

Last Release

180d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/34477826?v=4)[Kevin](/maintainers/kkevindev)[@kkevindev](https://github.com/kkevindev)

---

Top Contributors

[![kkevindev](https://avatars.githubusercontent.com/u/34477826?v=4)](https://github.com/kkevindev "kkevindev (3 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/kkevindev-assert-return-value/health.svg)

```
[![Health](https://phpackages.com/badges/kkevindev-assert-return-value/health.svg)](https://phpackages.com/packages/kkevindev-assert-return-value)
```

###  Alternatives

[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5275.9M121](/packages/symplify-monorepo-builder)[phpactor/phpactor

PHP refactoring and intellisense tool for text editors

1.9k17.1k1](/packages/phpactor-phpactor)[phpdocumentor/reflection

Reflection library to do Static Analysis for PHP Projects

12525.9M149](/packages/phpdocumentor-reflection)[sylius/promotion

Flexible promotion management for PHP applications.

28505.6k15](/packages/sylius-promotion)[sylius/money-bundle

Currencies and money formatting engine bundle for Symfony.

19681.3k26](/packages/sylius-money-bundle)[sylius/product

Product catalog system with support for product options and variants.

24394.2k22](/packages/sylius-product)

PHPackages © 2026

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