展示HN:Pipeflow-PHP – 即使是非开发者也能编辑的管道自动化任何事情
Show HN: Pipeflow-PHP – Automate anything with pipelines even non-devs can edit

原始链接: https://github.com/marcosiino/pipeflow-php

## Pipeflow:轻量级PHP管道引擎 Pipeflow是一个PHP库,旨在通过分解为可管理、可重用的阶段来简化复杂的自动化流程。这些阶段被链接在一起形成管道,管道可以以人类可读的XML格式定义和配置——即使是非开发人员也能维护和更新工作流程,而无需更改代码。或者,管道也可以直接在PHP中配置。 每个阶段都操作于共享的`PipelineContext`,接收和丰富在步骤之间传递的数据。这允许一致的数据处理和易于测试。Pipeflow非常适合内容生成(例如,通过其在自动发布着色页和童话故事中的应用)、数据处理、营销自动化以及与AI服务集成等任务。 主要功能包括可配置的运行时、用于自定义阶段的可扩展目录以及一种数据驱动的方法,允许在不重新部署代码的情况下进行调整。 详细的文档和贡献指南可供使用,以促进社区参与和持续改进。

## Pipeflow-PHP:人人皆可用的自动化工具 Marcosiino 开发了 Pipeflow-PHP,这是一个 PHP 管道引擎,旨在自动化任务——从内容创建到后端流程——并注重易用性。其关键特性是使用简单、易读的 XML 定义管道逻辑,即使是非开发者也能理解、维护和直接在现有的后端界面(如 WordPress)中编辑工作流。 Pipeflow 是一个*无头*引擎,这意味着它没有内置的 UI,但可以轻松地与现有系统集成。它支持控制流阶段(如果、ForEach、For),并且可以通过手动、cron 任务或自定义后端事件触发。用户可以构建自定义阶段并在管道中重用模块化组件。 目前,开发者使用 Pipeflow 自动化日常内容生成,包括 AI 辅助的着色页和 WordPress 帖子发布,由非技术人员管理。未来的计划包括将该引擎移植到其他语言。该项目在 GitHub 上接受反馈和贡献 ([https://github.com/marcosiino/pipeflow-php](https://github.com/marcosiino/pipeflow-php))。
相关文章

原文

Pipeflow is a lightweight pipeline engine for PHP applications. It lets you describe complex automations as a sequence of small, reusable processing steps called stages. The real superpower is that the entire flow can be expressed in a clear XML format that is easy to read, visualise, and reason about—so even non-developers can review, maintain, and update automations without touching PHP code (but you can also configure the pipelines via hard coded php code). Each stage receives a shared context, performs a focused unit of work, and returns the enriched context to the next stage. By chaining stages together you can orchestrate complex jobs while keeping each piece easy to maintain and test.

In other words Pipeflow library gives you the instruments to instantiate one or more pipelines from an xml configuration, providing starting data in an initial context (optionally), and execute them when you want. What you will need to do is use these instruments in your web application to allow your actors to: edit the pipeline's configurations xml (via a text editor), save the pipeline xml configuration somewhere (e.g. your application db), and, when your application need to start a pipeline (manually or through a cron), just load the xml, feed it in the Pipeline class instance, and launch it.

  • Human-friendly configuration – describe automations in an XML document that business users and developers alike can read, review, and edit safely.
  • Composable workflows – build sophisticated automations by wiring together focused stages instead of writing one-off scripts.
  • Consistent execution model – every stage works with the same PipelineContext, making it straightforward to pass data between steps.
  • Configurable runtime – author pipelines either in PHP or in XML, choose the configuration style that best fits your team.
  • Extensible catalogue – register your own custom stages to integrate third-party services, generative AI calls, or bespoke business logic.

Here is some real use cases which leverages the power of PipeFlow

  • PagineDaColorare.it: A wordpress website that automatically create and published coloring pages for children, daily, using the AI. This website uses two wordpress plugins I've developed (that maybe i will publish in future): one of them exposes pipeflow-php into wordpress, adding some custom stages to manage wordpress (creating posts, saving images, setting custom fields, category and tags) and allowing to modify the pipeline's xml from the wordpress admin panel (so that i can refine it, improve the content creation logic, change the logic on holidays, i.e. Christmas, and so on). The other plugins adds some more custom stages to pipeflow which allows to generate text and images with OpenAI apis. All these new custom stages is then used together to automatically run the coloring page content generation pipeline daily, with a cron. The advantage is that anyone, even non-developers, can refine, mantain, edit the coloring page content generation pipeline logic, simply by changing the XML configuration in the wordpress admin panel. The coloring page content generation pipeline configuration is now quite complex, but is very easy to read, understand and mantain: it combines many different stage types which randomizes coloring pages themes, subjects, actions, asking the supporting of the AI in different phases of the pipeline execution.

  • Fiaberello.it: Similar to the website above, this is another website I've developed with the power of pipeflow. It automaticallys creates and publish fairy tales for children, with a cover image for each tale. This is more a test/example, it's pipeline is more simple and refined than the previous one, so it can be even improved.

  • Editorial automation for any CMS – Create a plugin for your CMS which leverage pipeflow to build custom workflows which can be easily edited and refined by any actor in your team, even non developers: fetch posts, transform content, and trigger publication flows from scheduled pipelines, with editors able to tweak behaviour directly in XML, allowing any actor in your team (including non-developers) to mantain, refine, change the workflow.

  • Back-office data processing – build nightly ETL jobs that consume feeds, clean data, and sync results to downstream services without redeploying code.

  • Marketing and CRM orchestration – enrich leads, call external APIs, and keep SaaS tools in sync while letting stakeholders adjust logic themselves.

  • AI-assisted content workflows – combine prompt generation, randomisation, and templating stages to automate creative tasks, like i did on the websites above.

  • Any automation/workflow you can image, easily mantained by even non-developers - By allowing to create custom stages, you can encapsulate your custom business logic in new custom stages, which then can be used in your pipelines. These pipelines can then be edited, mantained or refined by any actor in your team, easily and visually by an easy to reason and read XML configuration.

Installation and Documentation

The full reference, including installation instructions, quick start, and detailed stage catalogue, lives in DOCUMENTATION.md.

Quick introduction to pipelines

A pipeline describes the ordered stages that should run and the data they exchange. Typical stages read or write values from the PipelineContext which is a container which contains parameters and their values, transform data, or control the flow of execution (loops, conditionals, etc.). The pipeline starts with an empty context, but you can feed a starting context from code if you want to provide the pipeline with prepared data to be available to the stages.

Each stage can reads and write data (parameters) to the context and perform operations (even custom operations by implementing custom stages, like calling apis, performing custom business logic operations, etc...), which can then be read and manipulated by the subsequent stages, until the pipelines finish the execution. At that point, the manipulated context is returned by the pipeline (with all the parameters written by the stages that has been executed).

Pipelines can be declared in XML so they can be edited without touching PHP code. A minimal XML pipeline looks like the following.

<?xml version="1.0" encoding="utf-8"?>
<pipeline id="hello_world">
  <stages>
    <stage type="SetValue">
      <settings>
        <param name="parameterName">message</param>
        <param name="parameterValue">Hello Pipeflow!</param>
      </settings>
    </stage>
    <stage type="Echo">
      <settings>
        <param name="text">%%message%%</param>
      </settings>
    </stage>
  </stages>
</pipeline>

Your application tells pipeflow to load the XML configuration, pipeflow will automatically configure the pipeline and prepares it for execution. Your application can then launch the pipeline when it's needed simply by calling the execute() method on the pipeline instance (on demand or even via a cron). If you want, you can also pass a pre-defined starting context (if you want to feed, for example, some data from code into the pipeline execution, that can be used by the stages).

Because the pipeline definition is data-driven, you can adjust parameters or reorder stages without redeploying code.

### Configuring programmatically via PHP Since XML is the easier way to configure pipelines "visually" and allows also non-developers to edit and mantain them by enabling any actor to manage automations in your web applications, you can also configure the pipelines programmatically in your php code. This may have sense for example for those business logic automations that doesn't need to be edited/mantained from your application administration panels, are fixed (doesn't change often), or doesn't need to be mantained by non-developers actors. More info in the DOCUMENTATION.md

Extending with custom stages

Pipeflow ships with a catalogue of built-in stages, but you can register your own custom stages to integrate APIs, internal systems, or platform-specific behaviour. Once registered, custom stages become available to both PHP and XML pipelines, letting you reuse them across projects.

The full reference, including installation instructions, control-flow stages, and detailed stage catalogue, lives in DOCUMENTATION.md.

Pipeflow thrives on community input and it surely needs improvements and features: Whether you want to improve the core engine, add new features, add new built-in stages, fix bugs, or share feedback from real-world deployments, we would love to collaborate. Check out CONTRIBUTING.md for guidelines on reporting issues, proposing ideas, and submitting pull requests.

Pipeflow is distributed under the permissive BSD 3-Clause License, which keeps the project friendly for both open-source and commercial use while encouraging community contributions.

联系我们 contact @ memedata.com