Download the PHP package tourze/dify-dsl without Composer
On this page you can find all versions of the php package tourze/dify-dsl. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package dify-dsl
Dify DSL PHP Library
中文
A framework-agnostic PHP library for parsing and generating Dify DSL (Domain-Specific Language) workflows.
Features
- Workflow Builder - Fluent API for building complex workflows with ease
- DSL Parser - Parse existing Dify DSL YAML files into PHP objects
- Code Generation - Generate valid Dify DSL YAML from PHP objects
- Node Types - Support for all major Dify node types
- Type Safety - Full PHP 8.2+ type declarations
- Validation - Built-in validation for workflow structure
- Extensible - Easy to extend with custom node types
Installation
Usage
1. Building Workflows with Fluent API
2. Parsing Existing YAML Files
Supported Node Types
The library supports all major Dify workflow node types:
- StartNode - Entry point variables for workflows
- EndNode - End points for Workflow mode
- AnswerNode - End points for Chatflow mode
- LLMNode - Language model nodes
- ToolNode - Tool/function calling nodes
- CodeNode - Custom code execution nodes
API Reference
WorkflowBuilder
| Method | Description |
|---|---|
setName(string $name) |
Set workflow name |
setDescription(string $desc) |
Set workflow description |
setMode(string $mode) |
Set workflow mode |
addStartNode(?callable $config) |
Add start node |
addLLMNode(?string $id, ?callable $config) |
Add LLM node |
addEndNode(?callable $config) |
Add end node |
build() |
Build the workflow app |
DifyParser
| Method | Description |
|---|---|
parse(string $yaml) |
Parse YAML string |
parseFile(string $path) |
Parse YAML file |
parseFromArray(array $data) |
Parse from array |
DifyGenerator
| Method | Description |
|---|---|
generate(App $app) |
Generate YAML string |
generateToFile(App $app, string $path) |
Generate to file |
generatePretty(App $app) |
Generate formatted YAML |
Examples
Check the examples/ directory for complete usage examples:
simple_workflow.php- Basic workflow creation and parsing
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
All versions of dify-dsl with dependencies
PHP Build Version
Package Version
The package tourze/dify-dsl contains the following files
Loading the files please wait ...