j45l / maybe-php
Maybe for PHP
Installs: 5 995
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^7.1|~8
- j45l/functional-php: ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ~3.0
- infection/infection: ^0.23.0
- jetbrains/phpstorm-attributes: ^1.0
- phpmd/phpmd: ^2.10
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.4
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- roave/security-advisories: dev-latest
- slevomat/coding-standard: ^7.0
- squizlabs/php_codesniffer: ~3.0
- dev-main
- v4.x-dev
- 4.1.3
- 4.1.2
- 4.1.1
- 4.1.0
- 4.0.0
- v3.x-dev
- 3.5.1
- 3.5.0
- 3.4.2
- 3.4.1
- 3.4.0
- 3.3.1
- 3.3.0
- 3.2.1
- 3.2.0
- 3.1.10.0
- 3.1.9.2
- 3.1.9.1
- 3.1.9.0
- 3.1.8.0
- 3.1.7.1
- 3.1.7.0
- 3.1.6.4
- 3.1.6.3
- 3.1.6.2
- 3.1.6.1
- 3.1.5.1
- 3.1.5.0
- 3.1.4.6
- 3.1.3.0
- 3.1.2.0
- 3.1.1.0
- 3.1.0.0
- 3.0.0.0
- v2.x-dev
- v1.x-dev
- 1.9.2.0
- 1.9.1.5
- 1.9.1.4
- 1.9.1.3
- 1.9.1.2
- 1.9.1.1
- 1.9.1.0
- 1.9.0.0
- 1.8.6.1
- 1.8.6.0
- 1.8.5.6
- 1.8.4.0
- 1.8.3.2
- 1.8.2.1
- 1.8.1.2
- 1.8.1.0
- 1.8.0.0
- 1.7.0.1
- 1.7.0.0
- 1.6.0.8
- 1.6.0.7
- 1.5.0.5
- 1.5.0.2
- 1.4.1.0
- 1.4.0.1
- 1.3.1.0
- 1.2.6.0
- 1.2.5.0
- 1.2.4.0
- 1.2.3.0
- 1.2.2.1
- v1.2.1.0
- 1.1.3.1
- dev-v1b
This package is auto-updated.
Last update: 2025-03-29 00:14:24 UTC
README
Optional (inspired by the functional thing), helps to:
- Better handling of exception (JustSuccess/Failure).
- Better typed alternative to the use of null (None/Some).
- Simplify the control flow on errors.
- Build failsafe code
- Improve testability.
Optional
Is a pragmatic version on the Optional/Either/Maybe from functional programing, it provides functionality present in such languages along some extra to solve some common use cases in php.
Some literature about, google for more:
https://www.thoughtworks.com/en-es/insights/blog/either-data-type-alternative-throwing-exceptions
https://itnext.io/either-monad-a-functional-approach-to-error-handling-in-js-ffdc2917ab2