承接 munusphp/munus 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

munusphp/munus

最新稳定版本:0.17.0

Composer 安装命令:

composer require munusphp/munus

包简介

Power of object-oriented programming with the elegance of functional programming.

README 文档

README

Minimum PHP Version github action Latest Stable Version codecov Total Downloads GitHub

Power of object-oriented programming with the elegance of functional programming. Increase the robustness with reduced amount of code.

At the moment, in the experimental phase.

Documentation

Due to the lack of generic types, Munus achieves genericity with the help of PHPStan template annotation.

Stream example: find the sum of the first ten squares of even numbers

Stream::from(1)
    ->filter(fn($n) => $n%2===0)
    ->map(fn($n) => $n**2)
    ->take(10)
    ->sum();

Other examples:

/** @var Stream<int> $stream */
$stream = Stream::range(1, 10)->map(function(int $int): int {return $int * 5});

/** @var Option<Success> $option */
$option = Option::of(domainOperation());

/** @return Either<Failure,Success> */
function domainOperation(): Either {}

/** @var TryTo<Result> $result */
$result = TryTo::run(function(){throw new \DomainException('use ddd');});
$result->getOrElse(new Result())

The goal is to help achieve: Psalm was able to infer types for 100% of the codebase

Features

Values:

  • TryTo
  • Either
  • Option
  • Lazy

Collections:

  • Set
  • Stream (implemented as lazy linked list)
  • GenericList (implemented as immutable linked list)
  • Iterator

Other:

  • Tuple

Roadmap

  • Pattern matching
  • Property checking

Inspiration

This library is inspired by vavr.io

License

Munus is released under the MIT Licence. See the bundled LICENSE file for details.

Author

@ArkadiuszKondas

统计信息

  • 总下载量: 81.64k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 169
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 168
  • Watchers: 9
  • Forks: 12
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-11-18