https://github.com/mckayb/phantasy
Functional Programming Helpers and Data Types for PHP
https://github.com/mckayb/phantasy
algebraic-data-types functional hacktoberfest phantasy php
Last synced: 4 months ago
JSON representation
Functional Programming Helpers and Data Types for PHP
- Host: GitHub
- URL: https://github.com/mckayb/phantasy
- Owner: mckayb
- License: mit
- Created: 2017-03-18T17:30:48.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-10-12T15:05:19.000Z (over 5 years ago)
- Last Synced: 2024-11-29T09:57:05.723Z (over 1 year ago)
- Topics: algebraic-data-types, functional, hacktoberfest, phantasy, php
- Language: PHP
- Homepage:
- Size: 443 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Phantasy [](https://circleci.com/gh/mckayb/phantasy)[](https://coveralls.io/github/mckayb/phantasy)
Functional Programming Helpers and Data Types for PHP.
## Getting Started
### Installation
`composer require mckayb/phantasy`
### Usage
```php
use Phantasy\DataTypes\Maybe\Maybe;
use function Phantasy\Core\prop;
$user = [ "name" => "Foo", "email" => "foo@example.com" ];
$name = Maybe::of($user)
->map(prop('name'))
->getOrElse(null);
// "Foo"
```
For more information, read the [docs!](https://github.com/mckayb/phantasy/tree/master/docs)
## What's Included
* Currying, Composition, Higher-Order Functions, etc
* Maybe, Either, Reader, Writer, State, Linked List, Validation Data Types.
* More coming...
## Contributing
Find a bug? Want to make any additions?
Just create an issue or open up a pull request.
## Want more?
For other helpers not included in this repo, check out
* [Phantasy-PHP](https://github.com/mckayb/phantasy-php)
* [Phantasy-Types](https://github.com/mckayb/phantasy-types)
* [Phantasy-Recursion-Schemes](https://github.com/mckayb/phantasy-recursion-schemes)
## Inspiration
* [Monet](https://github.com/monet/monet.js)
* [Folktale](https://github.com/origamitower/folktale)
* [Fantasy Land](https://github.com/fantasyland/fantasy-land)
* [Daggy](https://github.com/fantasyland/daggy)