PHPackages                             seiger/stask - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. seiger/stask

ActiveEvolutioncms-tool[Queues &amp; Workers](/categories/queues)

seiger/stask
============

Asynchronous task management system for Evolution CMS. Handle background operations and task queues with reliability and performance.

v1.0.8(2mo ago)2133↓50%11GPL-3.0PHPPHP ^8.3CI passing

Since Oct 16Pushed 2mo agoCompare

[ Source](https://github.com/Seiger/sTask)[ Packagist](https://packagist.org/packages/seiger/stask)[ Fund](https://ko-fi.com/seigerkornelyuk)[ RSS](/packages/seiger-stask/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (9)Dependencies (1)Versions (10)Used By (1)

sTask for Evolution CMS
=======================

[](#stask-for-evolution-cms)

[![sTask](https://private-user-images.githubusercontent.com/12029039/501754443-1431d4ab-c2ab-4b16-b14d-ceb49227930b.jpg?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQ0MzIzMDksIm5iZiI6MTc3NDQzMjAwOSwicGF0aCI6Ii8xMjAyOTAzOS81MDE3NTQ0NDMtMTQzMWQ0YWItYzJhYi00YjE2LWIxNGQtY2ViNDkyMjc5MzBiLmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAzMjUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMzI1VDA5NDY0OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ1ZWRmNzI0N2JkYjg3ZGFhYzgxYWI3YzcyOGM1MmQxNWY0MGVlZDNkYTU2ZjI1YmFkNjRmZTg4YzQ1ZDI4MTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.PSq3a2DkCK-3MEeX-EXqHyomI0M6qCD577IgxFjN3hM)](https://private-user-images.githubusercontent.com/12029039/501754443-1431d4ab-c2ab-4b16-b14d-ceb49227930b.jpg?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQ0MzIzMDksIm5iZiI6MTc3NDQzMjAwOSwicGF0aCI6Ii8xMjAyOTAzOS81MDE3NTQ0NDMtMTQzMWQ0YWItYzJhYi00YjE2LWIxNGQtY2ViNDkyMjc5MzBiLmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAzMjUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMzI1VDA5NDY0OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ1ZWRmNzI0N2JkYjg3ZGFhYzgxYWI3YzcyOGM1MmQxNWY0MGVlZDNkYTU2ZjI1YmFkNjRmZTg4YzQ1ZDI4MTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.PSq3a2DkCK-3MEeX-EXqHyomI0M6qCD577IgxFjN3hM)[![Latest Stable Version](https://camo.githubusercontent.com/b50f0e7754b3c6ea6527919c388c749be8941e42b86c57647a51e94d9aaeb324/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7365696765722f737461736b3f6c6162656c3d76657273696f6e)](https://packagist.org/packages/seiger/stask)[![CMS Evolution](https://camo.githubusercontent.com/7c60e51aeffcac06f808665cb99acb6e3422e0821c3f41397c4cfeceb176ccfd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f434d532d45766f6c7574696f6e2d627269676874677265656e2e737667)](https://github.com/evolution-cms/evolution)[![PHP version](https://camo.githubusercontent.com/f4fd0c3951e9d321afbebb14470ec7355993c6388ccc636f4a918d3b09419ba3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7365696765722f737461736b)](https://camo.githubusercontent.com/f4fd0c3951e9d321afbebb14470ec7355993c6388ccc636f4a918d3b09419ba3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7365696765722f737461736b)[![License](https://camo.githubusercontent.com/e8158fd023f40b90bf5e598a48feb29225cd1c59f3919709868a3f9074a8fee3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7365696765722f737461736b)](https://packagist.org/packages/seiger/stask)[![Issues](https://camo.githubusercontent.com/382d27884b10365a3d0bf977e93155af13415d012ae3fe8bec6e0664ea0e604c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f5365696765722f737461736b)](https://github.com/Seiger/stask/issues)[![Stars](https://camo.githubusercontent.com/8e9be8fac8e995f30fe95f3d37810de2cc7a7b88fa033ed65a710ba6eaaf4deb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f73746172732f5365696765722f737461736b)](https://packagist.org/packages/seiger/stask)[![Total Downloads](https://camo.githubusercontent.com/307f42aa76c608b174d43a2c5a93004eb2250f89818ead49cac5ac822227c680/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7365696765722f737461736b)](https://packagist.org/packages/seiger/stask)

Welcome to sTask!
-----------------

[](#welcome-to-stask)

**sTask** is a high-performance asynchronous task management system designed specifically for Evolution CMS. It provides an enterprise-grade framework for creating, executing, and monitoring background tasks with automatic worker discovery, comprehensive performance monitoring, and advanced caching capabilities.

Whether you need to process large data imports, generate reports, send emails in bulk, or perform any other time-consuming operations, **sTask** gives you the tools to handle these tasks efficiently without blocking your main application. Built with performance and scalability in mind, it's designed to become the fundamental task management solution for the entire Evolution CMS ecosystem.

Features
--------

[](#features)

### 🚀 Core Task Management

[](#-core-task-management)

- **Asynchronous Processing**: Execute long-running tasks in the background
- **Priority System**: Task prioritization (low, normal, high) with intelligent queuing
- **Progress Tracking**: Real-time progress monitoring (0-100%) via filesystem-based tracking
- **Status Management**: Complete task lifecycle (queued, preparing, running, finished, failed)
- **Retry Mechanism**: Configurable automatic retry with exponential backoff
- **File Downloads**: Download task results and exported files

### ⚡ High-Performance Architecture

[](#-high-performance-architecture)

- **Multi-Level Caching**: In-memory + Laravel cache for optimal worker resolution
- **Database Optimization**: Batch operations and optimized queries
- **Memory Management**: Automatic memory cleanup and resource management
- **Performance Metrics**: Real-time monitoring and analytics
- **System Health**: Automated health checks and performance alerts
- **Cache Statistics**: Detailed cache performance monitoring

### 🔧 Worker System

[](#-worker-system)

- **Automatic Discovery**: Auto-discovery of worker implementations from packages
- **Worker Registration**: Dynamic worker registration and activation/deactivation
- **Interface Validation**: Comprehensive worker validation and error handling
- **Custom Implementation**: Clean interface for custom worker development
- **Worker Settings**: Individual worker configuration and settings management

### 🎛️ Admin Interface

[](#️-admin-interface)

- **Modern Dashboard**: Clean, responsive interface with task statistics
- **Worker Management**: Visual worker management with card-based layout
- **Real-time Monitoring**: Live task progress and status updates
- **Performance Analytics**: Built-in performance monitoring and alerts
- **Cache Management**: Visual cache statistics and management tools

### 🔌 Developer Experience

[](#-developer-experience)

- **RESTful API**: Comprehensive API for task management and monitoring
- **Clean Architecture**: Well-structured, extensible codebase
- **Comprehensive Documentation**: Detailed docs with examples
- **Error Context**: Detailed error information for debugging
- **Performance Tools**: Built-in performance analysis and optimization tools

### 🔗 Integration

[](#-integration)

- **Evolution CMS**: Seamless integration with Evolution CMS manager
- **Menu Integration**: Custom logo and menu integration
- **Artisan Commands**: CLI tools for task management
- **Composer Package**: Auto-assets publishing and dependency management

Requirements
------------

[](#requirements)

- Evolution CMS **3.7+**
- PHP **8.3+**
- Composer **2.2+**
- One of: **MySQL 8.0+** / **MariaDB 10.5+** / **PostgreSQL 10+** / **SQLite 3.25+**

Installation
------------

[](#installation)

Go to Your `/core/` folder:

```
cd core
```

```
composer update
```

Run php artisan commands:

```
php artisan package:installrequire seiger/stask "*"
```

```
php artisan vendor:publish --tag=stask
```

```
php artisan migrate
```

### Setup Cron Job

[](#setup-cron-job)

Add the following cron job to run scheduled tasks every minute:

```
# Edit your crontab
crontab -e

# Add this line to run every minute
* * * * * cd /path/to/your/project && php artisan schedule:run >> /dev/null 2>&1
```

**Important**: Replace `/path/to/your/project` with the actual path to your Evolution CMS installation.

For shared hosting, you may need to use the full path to PHP:

```
* * * * * cd /path/to/your/project && /usr/bin/php artisan schedule:run >> /dev/null 2>&1
```

Quick Start
-----------

[](#quick-start)

### Creating a Task

[](#creating-a-task)

```
use Seiger\sTask\Facades\sTask;

// Create a new task
$task = sTask::create(
    identifier: 'product_sync',
    action: 'import',
    data: ['file' => '/path/to/products.csv'],
    priority: 'high',
    userId: evo()->getLoginUserID()
);
```

### Processing Tasks

[](#processing-tasks)

```
// Process pending tasks
$processedCount = sTask::processPendingTasks();

// Get task statistics
$stats = sTask::getStats();

// Get all incomplete tasks (pending, preparing, running)
$incomplete = \Seiger\sTask\Models\sTaskModel::incomplete()->get();
```

### Creating Custom Workers

[](#creating-custom-workers)

```
