humans/when

A global helper for if else statements

Maintainers

Details

github.com/humans/when

Source

Issues

Installs: 13 270

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

pkg:composer/humans/when

1.0.0 2021-03-09 10:07 UTC

This package is auto-updated.

Last update: 2025-10-09 20:36:35 UTC


README

Installation

composer require humans/when

Usage

echo when(true)->return('is-open');
// "is-open"

echo when(false)->return('is-open'); // prints null
// null

echo when(false)->return('is-open')->else('is-closed');
// "is-closed"

Comparison

echo when(true)->is(false)->return('is true')->else('is false');

Proxy

Proxies methods

when($product)->isOutOfStock()->return('is out of stock');

Proxies properties

when($product)->is_available->return('is available');

Global Methods

when();

unless();