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

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

auroro/result
=============

Errors as values: a Result type with Ok and Err variants

v0.5.1(3mo ago)02MITPHPPHP &gt;=8.3

Since Mar 16Pushed 1mo agoCompare

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

READMEChangelogDependencies (8)Versions (6)Used By (0)

auroro/result
=============

[](#aurororesult)

Errors as values: a Result type with `Ok` and `Err` variants for PHP 8.3+.

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

[](#installation)

```
composer require auroro/result
```

Usage
-----

[](#usage)

```
use Auroro\Result\Ok;
use Auroro\Result\Err;
use Auroro\Result\Result;

use function Auroro\Result\ok;
use function Auroro\Result\err;
```

### Creating results

[](#creating-results)

```
$ok  = new Ok(42);
$err = new Err('something went wrong');

// Or use the helper functions
$ok  = ok(42);
$err = err('something went wrong');
```

### Checking and unwrapping

[](#checking-and-unwrapping)

```
$result->isOk();       // true | false
$result->isErr();      // true | false
$result->unwrap();     // returns value or throws LogicException
$result->error();      // returns error or throws LogicException
$result->unwrapOr(0);  // returns value or the default
```

### Transforming

[](#transforming)

```
// Map the success value
ok(2)->map(fn ($v) => $v * 3);  // Ok(6)

// Chain into another Result
ok(10)->andThen(fn ($v) => $v > 0 ? ok($v) : err('negative'));

// Map the error
err('fail')->mapError(fn ($e) => "wrapped: $e");  // Err("wrapped: fail")
```

### Static factories

[](#static-factories)

```
// Wrap a callable — exceptions become Err
Result::try(fn () => riskyOperation());  // Ok(value) | Err(Throwable)

// Collect results — short-circuits on first Err
Result::all([ok(1), ok(2), ok(3)]);  // Ok([1, 2, 3])
Result::all([ok(1), err('x')]);      // Err('x')

// Null check
Result::from($value, 'missing');  // Ok($value) if non-null, Err('missing') if null
```

License
-------

[](#license)

MIT

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance88

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

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

Total

5

Last Release

100d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4679684?v=4)[Arindo Duque](/maintainers/aanduque)[@aanduque](https://github.com/aanduque)

---

Top Contributors

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

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[imanghafoori/laravel-nullable

A package to help you write expressive defensive code in a functional manner

151461.3k6](/packages/imanghafoori-laravel-nullable)[experius/module-multiplewebsitestorecodeurl

This module enabled you to use the same store\_code multiple times for different websites in the url.

1313.5k](/packages/experius-module-multiplewebsitestorecodeurl)

PHPackages © 2026

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