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

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

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

amphp/parallel-functions

最新稳定版本:v2.0.0

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.

统计信息

  • 总下载量: 9.94M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 281
  • 点击次数: 2
  • 依赖项目数: 31
  • 推荐数: 3

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固