1. Go to this page and download the library: Download kayedspace/laravel-n8n library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kayedspace / laravel-n8n example snippets
use KayedSpace\N8n\Facades\N8nClient;
// trigger webhook
$webhookTrigger =N8nClient::webhooks()->request("path-to-webhook",$payload);
// List all workflows
$workflows = N8nClient::workflows()->list();
// Retrieve execution status with data
$status = N8nClient::executions()->get($execution['id'],
//request a webhook
$webhookTrigger =N8nClient::webhooks()->request("path-to-webhook",$payload);
//request a webhook with custom basic auth credentials
//overwrites values provided on .env` file
$webhookTrigger =N8nClient::withBasicAuth("custom-username","custom-password")->request("path-to-webhook",$payload);
//request a webhook without auth
$webhookTrigger =N8nClient::withoutBasicAuth()->request("path-to-webhook",$payload);
// Get a list of executions filtered by status
$executions = N8nClient::executions()->list(['status' => 'success']);
// Get detailed execution data
$execution = N8nClient::executions()->get(101, true);
// Delete an execution
N8nClient::executions()->delete(101);
// Create a project
$project = N8nClient::projects()->create(['name' => 'DevOps', 'description' => 'CI/CD flows']);
// Add users
N8nClient::projects()->addUsers($project['id'], [
['userId' => 'abc123', 'role' => 'member'],
]);
// Promote user role
N8nClient::projects()->changeUserRole($project['id'], 'abc123', 'admin');
// Delete the project
N8nClient::projects()->delete($project['id']);
// List all tags
$tags = N8nClient::tags()->list();
// Create a tag
$newTag = N8nClient::tags()->create(['name' => 'marketing']);
// Update a tag
N8nClient::tags()->update($newTag['id'], ['name' => 'marketing-2025']);
// Delete a tag
N8nClient::tags()->delete($newTag['id']);
//list users
N8nClient::users()->list();
// Invite users
N8nClient::users()->create([
['email' => '[email protected]', 'role' => 'member']
]);
// Promote to admin
N8nClient::users()->changeRole('[email protected]', 'admin');
// delete a user
N8nClient::users()->delete('[email protected]');
// list all variable
N8nClient::variables()->list()
// Create a new variable
N8nClient::variables()->create(['key' => 'ENV_MODE', 'value' => 'production']);
// Update the variable
N8nClient::variables()->update('ENV_MODE', ['value' => 'staging']);
// Delete the variable
N8nClient::variables()->delete('ENV_MODE');
// Create and a workflow
$workflow = N8nClient::workflows()->create([
'name' => 'Daily Report',
'nodes' => [...], // full JSON definition
'connections' => [...],
]);
//Activate the workflow
N8nClient::workflows()->activate($workflow['id']);
//Deactivate the workflow
N8nClient::workflows()->deactivate($workflow['id']);
//update the workflow.
N8nClient::workflows()->update($workflow['id'],[...]);
//Move a workflow to a different project.
N8nClient::workflows()->transfer($workflow['id'],$destinationProjectId);
//Get all tags associated with the workflow.
N8nClient::workflows()->tags($workflow['id']);
// update workflow tags.
N8nClient::workflows()->updateTags($workflow['id'],[...]);
//Delete the workflow.
N8nClient::workflows()->delete($workflow['id']);
bash
php artisan vendor:publish --tag=n8n-config
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.