PHPackages                             jdwx/result - 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. jdwx/result

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jdwx/result
===========

A microscopic module for managing complex function call results.

v1.0.4(9mo ago)01331MITPHPPHP ^8.3

Since Sep 11Pushed 9mo agoCompare

[ Source](https://github.com/jdwx/result-php)[ Packagist](https://packagist.org/packages/jdwx/result)[ RSS](/packages/jdwx-result/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (5)Dependencies (4)Versions (6)Used By (1)

jdwx/result
===========

[](#jdwxresult)

A microscopic PHP module for managing complex function call results.

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

[](#installation)

You can require it directly with Composer:

```
composer require jdwx/result
```

Or download the source from GitHub:

Requirements
------------

[](#requirements)

This module requires PHP 8.3 or later.

Usage
-----

[](#usage)

This module provides a simple way to report the results of a function call, including success/failure state and a message. It is **loosely** inspired by the `Result` type in Rust.

Here is a basic usage example:

```
function ExampleFunction() : Result {
    return match( random_int( 0, 1 ) ) {
        0 => Result::err( 'This is an error message.' ),
        1 => Result::ok( 'This is an example message.', 42 ),
    };
}

$result = ExampleFunction();
if( $result->isOK() ) {
    echo "Success ({$result}) with value: ", $result->unwrap(), "\n";
} else {
    echo "Error: {$result}\n";

    # This will throw an exception
    $result->unwrap();
}
```

Stability
---------

[](#stability)

This module is considered stable and is used in production code.

History
-------

[](#history)

This module was refactored out of a private repository in September 2025 when the same functionality was needed for an unrelated project. DRY!

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance58

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

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 ~1 days

Total

5

Last Release

279d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f71b4b976170f89eac19be48c7381a27c49ed8c9cb5e8e6ff05a2ad7583efa13?d=identicon)[jdwx](/maintainers/jdwx)

---

Top Contributors

[![jdwx](https://avatars.githubusercontent.com/u/2722779?v=4)](https://github.com/jdwx "jdwx (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jdwx-result/health.svg)

```
[![Health](https://phpackages.com/badges/jdwx-result/health.svg)](https://phpackages.com/packages/jdwx-result)
```

###  Alternatives

[overtrue/laravel-vote

User Vote features for Laravel Application.

12718.8k](/packages/overtrue-laravel-vote)

PHPackages © 2026

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