humans / when
A global helper for if else statements
Installs: 11 253
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires (Dev)
- phpunit/phpunit: ^9.5
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();