PHPackages                             bosunski/results - 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. bosunski/results

ActiveLibrary

bosunski/results
================

Rust-like Result/Option utility for PHP

v0.0.1(2y ago)6836↑39.5%[1 issues](https://github.com/bosunski/results/issues)MITPHPPHP &gt;=8.0

Since Jan 14Pushed 2y ago2 watchersCompare

[ Source](https://github.com/bosunski/results)[ Packagist](https://packagist.org/packages/bosunski/results)[ RSS](/packages/bosunski-results/feed)WikiDiscussions main Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Results
=======

[](#results)

Results is a PHP simple (dependency-free) library that provides a set of helper functions and classes for handling optional values and results of operations. It is inspired by the [`Option`](https://doc.rust-lang.org/std/option/enum.Option.html) and [`Result`](https://doc.rust-lang.org/std/result/enum.Result.html) types in Rust. The implementation itself is based on the TypeScript implementation called [`ts-results`](https://github.com/vultix/ts-results).

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

[](#installation)

You can install the library through Composer:

```
composer require bosunski/results
```

Usage
-----

[](#usage)

### Demo

[](#demo)

You can try the package in this [Playground](https://play.phpsandbox.io/bosunski/results/v7oRmK4xw9K3G0kB)

### Option

[](#option)

The `Option` type represents an optional value: every `Option` is either `Some` and contains a value, or `None`, and does not.

```
