Download the PHP package hyperf/dag without Composer

On this page you can find all versions of the php package hyperf/dag. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package dag

hyperf/dag 是一个轻量级有向无环图 (Directed Acyclic Graph) 任务编排库。

场景

假设我们有一系列任务需要执行。

我们可以将第三种复杂的场景抽象成 DAG 来解决。

示例

假设我们有一系列任务,拓扑结构如上图所示,顶点代表任务,边缘代表依赖关系。(A完成后才能完成B、C、D,B完成后才能完成H、E、F...)

通过 hyperf/dag 可以使用如下方式构建 DAG 并执行。

输出:

DAG 会按照尽可能早的原则调度任务。尝试将 B 点的耗时调整为 2 秒,会发现 B 和 G 一起完成。

访问前步结果

每一个任务可以接收一个数组参数,数组中包含所有前置依赖的结果。DAG 执行完毕后,也会返回一个同样结构的数组,包含每一步的执行结果。

定义一个任务

在上述文档中,我们使用了闭包来定义一个任务。格式如下。

除了使用闭包函数定义任务外,还可以使用实现了 \Hyperf\Dag\Runner 接口的类来定义,并通过 Vertex::of 将其转化为一个顶点。

\Hyperf\Dag\Dag 本身也实现了 \Hyperf\Dag\Runner 接口,所以可以嵌套使用。

控制并发数

\Hyperf\Dag\Dag 类提供了 setConcurrency(int n) 方法控制最大并发数。默认为10。


All versions of dag with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
hyperf/support Version ~3.1.0
hyperf/utils Version ~3.1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hyperf/dag contains the following files

Loading the files please wait ....