Skip to content

MaybeMake absence and failure explicit.

Option, Result, Schema and DTO for dependency-light PHP 7.4+ applications. Adopt one boundary at a time across Windows and legacy codebases.

composer require gabrielalmir/maybeInstall →
customer.php
A PHP Result pipeline that makes success and failure explicit
use Maybe\Schema\Schema;

$result = Schema::shape([
    'email' => Schema::string()->trimmed(),
])->safeParse($payload)
    ->andThen(fn (array $data) => saveCustomer($data));

$result->match(
    fn (Customer $customer) => "Ok: saved",
    fn (mixed $error) => "Err: fix input"
);

Start at the boundary you already have

No framework coupling, no rewrite. Validate input, model a fallible service, and decide what happens at the edge.

Install the core primitives

composer require gabrielalmir/maybe
Read the first steps →

Use the boundary you have

New here? Read Why Maybe? for the trade-offs, follow the Tutorial to build a validated flow end to end, or keep the API Reference open while you work.