PHPackages                             yahlox/processor - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. yahlox/processor

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

yahlox/processor
================

A PHP workflow engine that parses ReactFlow JSON and supports Laravel package integration.

012↓90%PHPCI passing

Since Jun 5Pushed 1mo agoCompare

[ Source](https://github.com/yahlox/processor)[ Packagist](https://packagist.org/packages/yahlox/processor)[ RSS](/packages/yahlox-processor/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Yahlox Processor - Secure PHP Workflow Engine
=============================================

[](#yahlox-processor---secure-php-workflow-engine)

[![PHP Version](https://camo.githubusercontent.com/f575af1b648be492e22e809caebece8d6ae4d5319ad769664ee7a52e1c31c939/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344382e302d626c7565)](https://php.net)[![Laravel Version](https://camo.githubusercontent.com/f969efcdd48b1b903656baf0614882863d1a63239ade79916c536f2b8b2ec2ce/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302532432532303131253243253230313225324325323031332d677265656e)](https://laravel.com)[![License](https://camo.githubusercontent.com/8174925d009b42074d50ab5cc7e29fcb1aa613b0d9cb2e43097697a40cf90fa4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f77)](LICENSE)[![Tests](https://github.com/yahlox/processor/workflows/CI/badge.svg)](https://github.com/yahlox/processor/actions)

A powerful, secure PHP workflow engine that parses ReactFlow JSON diagrams and executes them as dynamic workflows. Perfect for automating complex business processes in Laravel applications.

🚀 Features
----------

[](#-features)

### Core Capabilities

[](#core-capabilities)

- ✅ **ReactFlow JSON Parsing** - Import workflows directly from React Flow designer
- ✅ **15+ Pre-built Nodes** - Email, SMS, HTTP, CRUD, conditions, loops, and more
- ✅ **Comprehensive Validation** - Cycle detection, connectivity checks, schema validation
- ✅ **Safe Expression Evaluation** - Secure variable substitution without code injection risks
- ✅ **Error Handling &amp; Recovery** - Error nodes, fallback paths, graceful degradation

### Security &amp; Reliability

[](#security--reliability)

- ✅ **Input Sanitization** - Automatic sanitization for emails, URLs, and user input
- ✅ **SQL Injection Protection** - Prepared statements for all database operations
- ✅ **XSS Prevention** - HTML content sanitization and escaping
- ✅ **Transaction Support** - ACID compliance for critical workflows
- ✅ **Saga Pattern** - Compensating transactions for distributed operations
- ✅ **Timeout Protection** - Prevents infinite loops and runaway executions
- ✅ **Rate Limiting** - Built-in rate limiting utilities
- ✅ **Retry Logic** - Exponential backoff for failed operations

### Observability

[](#observability)

- ✅ **Comprehensive Logging** - PSR-3 logger integration for all operations
- ✅ **Execution Tracking** - Detailed logging of workflow execution
- ✅ **Error Context** - Rich context information in error messages
- ✅ **Audit Trail** - Track who executed what and when

### Developer Experience

[](#developer-experience)

- ✅ **Easy Integration** - Simple Laravel service provider
- ✅ **Well Documented** - Comprehensive guides and examples
- ✅ **Type Hints** - Full PHP 8 type support
- ✅ **Extensible** - Custom processors and strategies
- ✅ **PHP 8.0+** - Modern PHP with backward compatibility
- ✅ **Multi-Laravel** - Works with Laravel 10-13

📦 Installation
--------------

[](#-installation)

```
composer require yahlox/processor
```

### Requirements

[](#requirements)

- PHP 8.0+
- Laravel 10+
- JSON extension
- cURL extension

🎯 Quick Start
-------------

[](#-quick-start)

```
use Yahlox\Parser\ReactFlowParser;
use Yahlox\Engine\WorkflowValidator;
use Yahlox\Engine\WorkflowExecutor;
use Yahlox\Engine\ExpressionEvaluator;
use Yahlox\Registry\NodeProcessorRegistry;
use Yahlox\Domain\ExecutionContext;

// 1. Parse workflow from ReactFlow
$parser = new ReactFlowParser(strictValidation: true);
$workflow = $parser->parse($jsonPayload);

// 2. Validate workflow
$validator = new WorkflowValidator();
$validator->validate($workflow);

// 3. Create executor
$registry = new NodeProcessorRegistry();
$executor = new WorkflowExecutor(
    registry: $registry,
    validator: $validator,
    expressionEvaluator: new ExpressionEvaluator(),
    timeoutSeconds: 300
);

// 4. Set up context
$context = new ExecutionContext();
$context->set('user_email', 'user@example.com');
$context->set('order_id', 12345);

// 5. Execute workflow
try {
    $executor->execute($workflow, $context);
    echo "Success!";
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}
```

📚 Documentation
---------------

[](#-documentation)

- **[Complete User Guide](docs/GUIDE.md)** - Detailed documentation with examples
- **[Security Guide](docs/SECURITY.md)** - Security best practices and features
- **[Migration Guide](MIGRATION.md)** - Upgrading from v1.x to v2.x
- **[Node Catalog](docs/GUIDE.md#node-types)** - All available node types

🏗️ Workflow Structure
---------------------

[](#️-workflow-structure)

A workflow consists of **nodes** (operations) and **edges** (connections):

```
{
  "nodes": [
    { "id": "start", "type": "start", "data": {} },
    { "id": "email", "type": "sendEmail", "data": {
      "to": "{user_email}",
      "subject": "Welcome",
      "body": "Hello {name}!"
    } },
    { "id": "end", "type": "end", "data": {} }
  ],
  "edges": [
    { "source": "start", "target": "email" },
    { "source": "email", "target": "end" }
  ]
}
```

🔧 Node Types
------------

[](#-node-types)

TypePurposeExample`start`Workflow entry pointBegin execution`end`Workflow exit pointComplete execution`condition`Branching logicIf amount &gt; 1000`switch`Multiple branchesSwitch on status`loop`Iterate collectionProcess each item`createRecord`Insert database recordCreate user`readRecord`Fetch recordsGet order`updateRecord`Modify recordsUpdate status`deleteRecord`Remove recordsDelete user`sendEmail`Send emailsEmail notification`sendSms`Send SMSSMS alert`sendNotification`In-app notificationsNotify user`httpRequest`HTTP API callsCall webhook`delay`Pause executionWait 5 seconds`error`Error handlerHandle failures`custom`Custom logicRun custom code🔐 Security Highlights
---------------------

[](#-security-highlights)

### 1. Safe Variable Substitution

[](#1-safe-variable-substitution)

```
// NOT vulnerable to injection
$evaluator->evaluate("{email} at {company}", $context);
// Even if {email} contains PHP code, it's treated as a string
```

### 2. Input Validation

[](#2-input-validation)

```
use Yahlox\Utils\InputSanitizer;

$email = InputSanitizer::sanitize($value, 'email');  // Validates email format
$url = InputSanitizer::sanitize($value, 'url');      // Validates URL format
```

### 3. SQL Injection Protection

[](#3-sql-injection-protection)

```
{
  "type": "createRecord",
  "data": {
    "fields": {
      "name": "{user_input}",  // Automatically parameterized
      "email": "{email_input}"
    }
  }
}
```

### 4. XSS Prevention

[](#4-xss-prevention)

```
{
  "type": "sendEmail",
  "data": {
    "body": "User data: {user_data}",
    "htmlContent": true  // Automatically sanitized
  }
}
```

### 5. Timeout Protection

[](#5-timeout-protection)

```
$executor = new WorkflowExecutor(
    // ... other params
    timeoutSeconds: 300  // Max 5 minutes
);
```

### 6. Workflow Validation

[](#6-workflow-validation)

All workflows are validated:

- ✅ Exactly one start node
- ✅ At least one end node
- ✅ No cycles (must be DAG)
- ✅ All nodes reachable
- ✅ Valid node types only

📊 Advanced Features
-------------------

[](#-advanced-features)

### Transaction Support

[](#transaction-support)

```
{
  "type": "createRecord",
  "data": {
    "transaction": true,
    "connection": "default"
  }
}
```

### Retry Logic

[](#retry-logic)

```
use Yahlox\Utils\RetryPolicy;

$policy = new RetryPolicy(
    maxAttempts: 3,
    initialDelayMs: 100,
    backoffMultiplier: 2.0
);
$result = $policy->execute($operation);
```

### Rate Limiting

[](#rate-limiting)

```
use Yahlox\Utils\RateLimiter;

$limiter = new RateLimiter();
if (!$limiter->isAllowed('email_sends', 100, 3600)) {
    throw new RateLimitException('Too many emails');
}
```

### Conditional Routing

[](#conditional-routing)

```
{
  "edges": [{
    "source": "check",
    "target": "approve",
    "data": {
      "condition": "{amount} > 1000 && {status} == 'active'"
    }
  }]
}
```

### Error Handling

[](#error-handling)

```
{
  "type": "error",
  "data": {
    "message": "Processing failed",
    "log": true,
    "stopExecution": false,
    "storeAs": "error_info"
  }
}
```

🧪 Testing
---------

[](#-testing)

```
# Run tests
composer test

# With coverage
composer test:coverage

# Static analysis
composer analyze

# Code quality checks
composer rector
```

📝 Configuration
---------------

[](#-configuration)

### PHPStan

[](#phpstan)

Static analysis is configured in `phpstan.neon` at level 8 (maximum strictness).

### PHP CS Fixer

[](#php-cs-fixer)

Code style is PSR-12 with strict rules. Run:

```
composer fix
```

### GitHub Actions

[](#github-actions)

CI/CD pipeline runs on push and PR:

- Tests on PHP 8.0-8.3
- PHPStan analysis
- Code style checks
- Security scanning

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome! Please:

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit changes (`git commit -m 'Add amazing feature'`)
4. Push to branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

📄 License
---------

[](#-license)

MIT License - see [LICENSE](LICENSE) file for details.

🆘 Support
---------

[](#-support)

- 📖 [Full Documentation](docs/GUIDE.md)
- 🔒 [Security Guide](docs/SECURITY.md)
- 📱 [Migration Guide](MIGRATION.md)
- 🐛 [Issues](https://github.com/yahlox/processor/issues)
- 💬 Email:

🙏 Acknowledgments
-----------------

[](#-acknowledgments)

- Built with PHP 8 best practices
- Inspired by ReactFlow and modern workflow engines
- Security-first design approach

📋 Changelog
-----------

[](#-changelog)

See [MIGRATION.md](MIGRATION.md) for detailed changelog and upgrade information.

---

**Made with ❤️ by the Yahlox team**

###  Health Score

20

—

LowBetter than 12% of packages

Maintenance59

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/38426d30055244c714797de191e6c3824103261557e945de97ac37087fad4fb4?d=identicon)[yahlox-angelo](/maintainers/yahlox-angelo)

---

Top Contributors

[![c3abisquera](https://avatars.githubusercontent.com/u/148520499?v=4)](https://github.com/c3abisquera "c3abisquera (21 commits)")

### Embed Badge

![Health badge](/badges/yahlox-processor/health.svg)

```
[![Health](https://phpackages.com/badges/yahlox-processor/health.svg)](https://phpackages.com/packages/yahlox-processor)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
