mrkindy/n8n-laravel
Composer 安装命令:
composer require mrkindy/n8n-laravel
包简介
Laravel package for integrating with n8n API using clean architecture patterns
关键字:
README 文档
README
A comprehensive Laravel package for integrating with the n8n API using clean architecture patterns. This package provides a facade-based interface with support for multiple execution strategies, request builders, and event observability.
Features
- Facade - Simple static interface (
N8N::workflows()) - Adapter - Clean abstraction of n8n API communication
- Strategy - Multiple execution strategies (sync, async, queued)
- Builder - Fluent API for constructing complex payloads
- Observer - Event hooks for request lifecycle
- Clean Architecture - SOLID principles and separation of concerns
- Type Safety - Full PHP 8.1+ type hints and strict typing
- Event System - Laravel events for request monitoring
- Comprehensive Testing - Pest framework with full test coverage
Installation
composer require mrkindy/n8n-laravel
Publish Configuration
php artisan vendor:publish --provider="MrKindy\N8NLaravel\N8NServiceProvider" --tag="n8n-config"
Environment Configuration
Add these variables to your .env file:
N8N_BASE_URL=http://localhost:5678 N8N_API_KEY=your-api-key-here N8N_DEFAULT_STRATEGY=sync N8N_HTTP_TIMEOUT=30 N8N_HTTP_RETRY_TIMES=3 N8N_HTTP_RETRY_SLEEP=1000 N8N_HTTP_VERIFY_SSL=true N8N_EVENTS_ENABLED=true N8N_LOGGING_ENABLED=true N8N_LOGGING_LEVEL=info N8N_LOGGING_CHANNEL=default N8N_QUEUE_CONNECTION=default N8N_QUEUE_NAME=n8n
Usage
For detailed usage instructions, please refer to DOCUMENTATION.md.
Testing
The package uses the Pest testing framework. Run tests with:
vendor/bin/pest
Test Structure
tests/
├── Pest.php # Pest configuration
├── TestCase.php # Base test case
├── Feature/
│ ├── FacadeTest.php # Facade functionality tests
│ ├── BuilderTest.php # Builder tests
│ ├── ObserverTest.php # Observer tests
│ └── StrategyTest.php # Strategy tests
└── Unit/
├── AdapterTest.php # Adapter unit tests
└── ServiceTest.php # Individual service tests
Writing Tests
use MrKindy\N8NLaravel\Facades\N8N; it('can create a workflow', function () { Http::fake([ 'localhost:5678/api/v1/workflows' => Http::response([ 'id' => 'workflow-123', 'name' => 'Test Workflow' ]) ]); $result = N8N::workflows()->create([ 'name' => 'Test Workflow', 'nodes' => [] ]); expect($result)->toHaveKey('id', 'workflow-123'); });
Configuration Reference
HTTP Client Options
'http' => [ 'timeout' => 30, // Request timeout in seconds 'retry' => [ 'times' => 3, // Number of retry attempts 'sleep' => 1000, // Sleep between retries (ms) ], 'verify' => true, // SSL certificate verification ],
Queue Configuration
'queue' => [ 'connection' => 'redis', // Queue connection 'queue' => 'n8n-operations', // Queue name ],
Logging Configuration
'logging' => [ 'enabled' => true, // Enable request logging 'level' => 'info', // Log level 'channel' => 'n8n', // Log channel ],
API Coverage
This package provides full coverage of the n8n Public API v1.1.1:
Workflows
- ✅ List workflows
- ✅ Get workflow
- ✅ Create workflow
- ✅ Update workflow
- ✅ Delete workflow
- ✅ Activate workflow
- ✅ Deactivate workflow
- ✅ Transfer workflow
- ✅ Get workflow tags
- ✅ Update workflow tags
Credentials
- ✅ Create credential
- ✅ Delete credential
- ✅ Get credential schema
- ✅ Transfer credential
Executions
- ✅ List executions
- ✅ Get execution
- ✅ Delete execution
Users (Enterprise)
- ✅ List users
- ✅ Get user
- ✅ Create users
- ✅ Delete user
- ✅ Change user role
Tags
- ✅ List tags
- ✅ Get tag
- ✅ Create tag
- ✅ Update tag
- ✅ Delete tag
Variables
- ✅ List variables
- ✅ Create variable
- ✅ Update variable
- ✅ Delete variable
Projects (Enterprise)
- ✅ List projects
- ✅ Create project
- ✅ Delete project
- ✅ Add users to project
Audit
- ✅ Generate audit
Source Control
- ✅ Pull changes
Contributing
- Fork the repository
- Create a feature branch
- Write tests for your changes
- Ensure all tests pass:
vendor/bin/pest - Follow PSR-12 coding standards
- Submit a pull request
Development Setup
git clone https://github.com/mrkindy/n8n-laravel.git cd n8n-laravel composer install cp .env.example .env # Configure your n8n instance details in .env vendor/bin/pest
Requirements
- PHP 8.1+
- Laravel 10.0+ or 11.0+
- n8n instance with API access
License
This package is open-sourced software licensed under the MIT license.
Support
Changelog
Please see CHANGELOG for more information on what has changed recently.
Built with ❤️ for the Laravel and n8n communities.
mrkindy/n8n-laravel 适用场景与选型建议
mrkindy/n8n-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 4, 最近一次更新时间为 2025 年 08 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「workflow」 「laravel」 「automation」 「n8n」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mrkindy/n8n-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mrkindy/n8n-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mrkindy/n8n-laravel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Workflow for NetCommons Plugin
Workflow logger
A PSR-7 compatible library for making CRUD API endpoints
Approval Workflow Engine for Filament
Operational approvals engine for Laravel applications.
Alfabank REST API integration
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-18