定制 im0rtality/underscore 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

im0rtality/underscore

Composer 安装命令:

composer require im0rtality/underscore

包简介

Functional programming library for PHP

README 文档

README

Build Status Scrutinizer Quality Score Code Coverage SensioLabsInsight

Functional programming library for PHP

Code example

Library aims to be as easy to use as possible. Here is example of doing some not-so-meaningful operations to show off:

    Underscore::from([1,2,3,4,5])
            // convert array format
        ->map(function($num) { return ['number' => $num];})
            // filter out odd elements
        ->filter(function($item) { return ($item['number'] % 2) == 0;})
            // vardump elements
        ->invoke(function($item) { var_dump($item);})
            // changed my mind, I only want numbers
        ->pick('number')
            // add numbers to 1000
        ->reduce(function($sum, $num) { $sum += $num; return $sum; }, 1000)
            // take result
        ->value();
            // 1006

Motivation

Originaly I needed functional programming magic for other project, so had to pick one lib or write my own.

There is several PHP ports of UnderscoreJS, however none of those fit my requirements (nice code, easy to write, standardized):

Installation

Via composer:

$ composer require im0rtality/underscore:*

Composer docs recommend to use specific version. You can look them up in Releases.

Documentation

See wiki

Tests

Tests generate coverage reports in clover.xml format

$ vendor/bin/phpunit

License

MIT License: You can do whatever you want as long as you include the original copyright.

统计信息

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

GitHub 信息

  • Stars: 41
  • Watchers: 5
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-03-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固