定制 jpcaparas/laravel-n8n-client 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

jpcaparas/laravel-n8n-client

最新稳定版本:v0.1.0

Composer 安装命令:

composer require jpcaparas/laravel-n8n-client

包简介

A Laravel library that interfaces with the self-hosted n8n.io REST API

README 文档

README

Tests

A Laravel library that interfaces with the self-hosted n8n REST API.

SCR-20250107-rpsu

Installation

You can install the package via Composer:

composer require jpcaparas/laravel-n8n-client

Publish the configuration file:

php artisan vendor:publish --provider="JPCaparas\N8N\N8NServiceProvider" --tag="config"

Set these credentials inside your .env file:

N8N_BASE_URI=http://[your_n8n_instance]:[your_n8n_port]
N8N_API_TOKEN=[your_n8n_api_token]

Local testing

If you want to interact with the package locally, you can use the Laravel skeleton provided by orchestra/testbench and its associated Tinker REPL:

  1. Publish the configuration file to the Laravel skeleton.
composer test:publish
  1. Modify .env API credentials on the skeleton as needed:
N8N_BASE_URI=http://localhost:5678
N8N_API_TOKEN=[your_n8n_api_token]
  1. Enter the Tinker REPL:
composer test:tinker
  1. Create an instance of the N8N client:
$n8n = app(\JPCaparas\N8N\N8NClient::class);
  1. Make API requests using the N8N client:
$response = $n8n->get('valid-endpoint');
$response = $n8n->post('valid-endpoint', ['data' => 'value']);

There are also convenience methods for the most common API endpoints:

$response = $n8n->getWorkflows();
$response = $n8n->getWorkflow('workflow-id');
$response = $n8n->createWorkflow(['name' => 'New Workflow']);
$response = $n8n->updateWorkflow('workflow-id', ['name' => 'Updated Workflow']);

Tests

composer test

License

MIT

统计信息

  • 总下载量: 890
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 14
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 14
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-07