amphp/parallel-functions 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

amphp/parallel-functions

Composer 安装命令:

composer require amphp/parallel-functions

包简介

Parallel processing made simple.

README 文档

README

AMPHP is a collection of event-driven libraries for PHP designed with fibers and concurrency in mind. amphp/parallel-functions provides a utility function which wraps a callable into another callable which will execute on another process or thread. All data within the callable object or closure must be serializable.

See the Worker and Task interfaces in amphp/parallel for a more flexible and customizable API for running tasks in parallel.

Latest Release License

Installation

This package can be installed as a Composer dependency.

composer require amphp/parallel-functions

Requirements

  • PHP 8.1+

Example

<?php

use function Amp\ParallelFunctions\parallelMap;

$responses = parallelMap([
    'https://google.com/',
    'https://github.com/',
    'https://stackoverflow.com/',
], function ($url) {
    return file_get_contents($url);
});

Note that file_get_contents() is being used here as an example blocking function (that is, a function which halts the process while awaiting I/O).

We recommend performing HTTP requests using amphp/http-client.

The best functions to parallelize are those which perform many CPU-intensive calcuations or blocking functions which would be difficult or time-consuming to implement in a non-blocking way.

Further examples can be found in the ./examples directory.

Versioning

amphp/parallel-functions follows the semver semantic versioning specification like all other amphp packages.

Security

If you discover any security related issues, please use the private security issue reporter instead of using the public issue tracker.

License

The MIT License (MIT). Please see LICENSE for more information.

amphp/parallel-functions 适用场景与选型建议

amphp/parallel-functions 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.58M 次下载、GitHub Stars 达 279, 最近一次更新时间为 2017 年 12 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 amphp/parallel-functions 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 amphp/parallel-functions 我们能提供哪些服务?
定制开发 / 二次开发

基于 amphp/parallel-functions 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 10.58M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 280
  • 点击次数: 18
  • 依赖项目数: 32
  • 推荐数: 3

GitHub 信息

  • Stars: 279
  • Watchers: 11
  • Forks: 18
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-12-13