PHPackages                             tekord/php-option - 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. tekord/php-option

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

tekord/php-option
=================

Option object for PHP inspired by the Rust programming language

v0.3(1y ago)032MITPHPPHP &gt;=8.1

Since Oct 30Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/tekord/php-option)[ Packagist](https://packagist.org/packages/tekord/php-option)[ Docs](https://github.com/tekord/php-option)[ RSS](/packages/tekord-php-option/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (6)Used By (0)

Rust-inspired Option object for PHP
===================================

[](#rust-inspired-option-object-for-php)

TBD

[![PHP Version Support](https://camo.githubusercontent.com/cbce9c6ea18a8076005c4315fb4a56133b37017e8280130b61bf5d436c31b9a5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f74656b6f72642f7068702d6f7074696f6e3f6c6f676f3d70687026636f6c6f723d383839324246)](https://www.php.net/supported-versions.php)[![Packagist version](https://camo.githubusercontent.com/22eaeb2d663697ca0f4caadf9174a302a4236331683b84e30ebaa5cce3cd3747/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74656b6f72642f7068702d6f7074696f6e2e7376673f6c6f676f3d7061636b6167697374)](https://packagist.org/packages/tekord/php-option)[![License](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](https://github.com/tekord/php-option/blob/main/LICENSE-MIT)

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

[](#installation)

Install the package via Composer:

```
composer require tekord/php-option
```

Usage
-----

[](#usage)

Example:

```
$o = Option::some(200);
$value = $o->unwrap(); // -> 200

$o = Option::none();
$value = $o->unwrap(); // -> ERROR

$o = Option::none();
$value = $o->unwrapOrDefault(50); // -> 50

$o = Option::none();
$value = $o->unwrapOrNull(); // -> null

$o = Option::some("Hello");
$o->isSome(); // true
$o->isNone(); // false

$o = Option::none();
$o->isSome(); // false
$o->isNone(); // true
```

Testing
-------

[](#testing)

```
composer test
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance68

Regular maintenance activity

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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

Total

4

Last Release

83d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0f3c0971c1772194004645045af84bba7059bff710578b4a29c97d850c51cbdf?d=identicon)[tekord](/maintainers/tekord)

---

Top Contributors

[![tekord](https://avatars.githubusercontent.com/u/1286100?v=4)](https://github.com/tekord "tekord (14 commits)")

---

Tags

phpoptionerror handlingdata structuresoptionalnullnullable

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tekord-php-option/health.svg)

```
[![Health](https://phpackages.com/badges/tekord-php-option/health.svg)](https://phpackages.com/packages/tekord-php-option)
```

###  Alternatives

[phpoption/phpoption

Option Type for PHP

2.7k541.2M159](/packages/phpoption-phpoption)[php-ds/php-ds

Specialized data structures as alternatives to the PHP array

4108.8M134](/packages/php-ds-php-ds)[judev/php-intervaltree

Interval Tree implementation in PHP

1138.8k1](/packages/judev-php-intervaltree)

PHPackages © 2026

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