PHPackages                             brimmar/phpoption - 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. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. brimmar/phpoption

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

brimmar/phpoption
=================

Rust-like Option Type implementation for PHP

v1.1.0(5mo ago)13721[3 PRs](https://github.com/brimmar/phpoption/pulls)MITPHPPHP &gt;=8.3CI passing

Since Aug 1Pushed 1mo ago1 watchersCompare

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

READMEChangelogDependencies (3)Versions (11)Used By (0)

PHP Option Type Documentation
=============================

[](#php-option-type-documentation)

[![Tests](https://github.com/brimmar/phpoption/actions/workflows/tests.yml/badge.svg)](https://github.com/brimmar/phpoption/actions/workflows/tests.yml)[![Static Analysis](https://github.com/brimmar/phpoption/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/brimmar/phpoption/actions/workflows/static-analysis.yml)[![License](https://camo.githubusercontent.com/72f75d398d6bf11dafce76256670dcecc8ce9c9be7e8db40a2ddd4b6663bedce/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6272696d6d61722f7068706f7074696f6e)](https://packagist.org/packages/brimmar/phpoption)[![Latest Stable Version](https://camo.githubusercontent.com/5ce5338b586b6396d22d110a195c487986a3eb8df807327f82d80c02070de68c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6272696d6d61722f7068706f7074696f6e)](https://packagist.org/packages/brimmar/phpoption)[![Total Downloads](https://camo.githubusercontent.com/75eedd85b99f96be1dc2d13ceecbe0d2bdc58d533ee2c0d37f41cae2a6d96307/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6272696d6d61722f7068706f7074696f6e)](https://packagist.org/packages/brimmar/phpoption)

This documentation covers the implementation of a Rust-like Option Type for PHP. The Option type is used for representing optional values. It has two variants: `Some`, representing the presence of a value, and `None`, representing the absence of a value.

Table of Contents
-----------------

[](#table-of-contents)

1. [Option Interface](#option-interface)
2. [Usage](#usage)
3. [Methods](#methods)
4. [Complementary Packages](#complementary-packages)
5. [Static Analysis](#static-analysis)
6. [Contributing](#contributing)
7. [Security Vulnerabilities](#security-vulnerabilities)
8. [License](#license)

Option Interface
----------------

[](#option-interface)

The `Option` interface defines the contract for both `Some` and `None` classes.

```
